| 725 | |
| 726 | |
| 727 | bool cUnixFSServices::GetExecutableFilename(TSTRING& strFullPath, const TSTRING& strFilename) const |
| 728 | { |
| 729 | bool fGotName = false; |
| 730 | |
| 731 | if (strFilename.empty()) |
| 732 | return false; |
| 733 | |
| 734 | // if there is a slash in the filename, it's absolute or relative to cwd |
| 735 | if (TSTRING::npos != strFilename.find(_T('/'))) |
| 736 | { |
| 737 | // if absolute path |
| 738 | if (strFilename[0] == _T('/')) |
| 739 | { |
| 740 | strFullPath = strFilename; |
| 741 | fGotName = true; |
| 742 | } |
| 743 | else // is relative path; find path from cwd |
| 744 | { |
| 745 | fGotName = FullPath(strFullPath, strFilename); |
| 746 | } |
| 747 | } |
| 748 | else // it's just a filename: should be found in path |
| 749 | { |
| 750 | fGotName = util_PathFind(strFullPath, strFilename); |
| 751 | |
| 752 | TSTRING strFP; |
| 753 | if (fGotName && FullPath(strFP, strFullPath)) |
| 754 | strFullPath = strFP; |
| 755 | } |
| 756 | |
| 757 | return (fGotName); |
| 758 | } |
| 759 | |
| 760 | |
| 761 | /////////////////////////////////////////////////////////////////////////////// |