| 10866 | } |
| 10867 | |
| 10868 | VarSizeType Script::GetLoopFileDir(char *aBuf) |
| 10869 | { |
| 10870 | char *str = ""; // Set default. |
| 10871 | char *last_backslash = NULL; |
| 10872 | if (mLoopFile) |
| 10873 | { |
| 10874 | // The loop handler already prepended the script's directory in here for us. |
| 10875 | // But if the loop had a relative path in its FilePattern, there might be |
| 10876 | // only a relative directory here, or no directory at all if the current |
| 10877 | // file is in the origin/root dir of the search: |
| 10878 | if (last_backslash = strrchr(mLoopFile->cFileName, '\\')) |
| 10879 | { |
| 10880 | *last_backslash = '\0'; // Temporarily terminate. |
| 10881 | str = mLoopFile->cFileName; |
| 10882 | } |
| 10883 | else // No backslash, so there is no directory in this case. |
| 10884 | str = ""; |
| 10885 | } |
| 10886 | VarSizeType length = (VarSizeType)strlen(str); |
| 10887 | if (!aBuf) |
| 10888 | { |
| 10889 | if (last_backslash) |
| 10890 | *last_backslash = '\\'; // Restore the orginal value. |
| 10891 | return length; |
| 10892 | } |
| 10893 | strcpy(aBuf, str); |
| 10894 | if (last_backslash) |
| 10895 | *last_backslash = '\\'; // Restore the orginal value. |
| 10896 | return length; |
| 10897 | } |
| 10898 | |
| 10899 | VarSizeType Script::GetLoopFileFullPath(char *aBuf) |
| 10900 | { |