| 10164 | } |
| 10165 | |
| 10166 | void FixLoopFilePath(LPTSTR aBuf, LPTSTR aPattern) |
| 10167 | // Fixes aBuf to account for "." and ".." as file patterns. These match the directory itself |
| 10168 | // or parent directory, so for example "x\y\.." returns a directory named "x" which appears to |
| 10169 | // be inside "y". Without the handling here, the invalid path "x\y\x" would be returned. |
| 10170 | // A small amount of temporary buffer space might be wasted compared to handling this in the BIV, |
| 10171 | // but this way minimizes code size (and these cases are rare anyway). |
| 10172 | { |
| 10173 | int count = 0; |
| 10174 | if (*aPattern == '.') |
| 10175 | { |
| 10176 | if (!aPattern[1]) |
| 10177 | count = 1; // aBuf "x\y\y" should be "x\y" for "x\y\.". |
| 10178 | else if (aPattern[1] == '.' && !aPattern[2]) |
| 10179 | count = 2; // aBuf "x\y\x" should be "x" for "x\y\..". |
| 10180 | } |
| 10181 | for ( ; count > 0; --count) |
| 10182 | { |
| 10183 | LPTSTR end = _tcsrchr(aBuf, '\\'); |
| 10184 | if (end) |
| 10185 | *end = '\0'; |
| 10186 | else if (*aBuf && aBuf[1] == ':') // aBuf "C:x" should be "C:" for "C:" or "C:.". |
| 10187 | aBuf[2] = '\0'; |
| 10188 | } |
| 10189 | } |
| 10190 | |
| 10191 | void ReturnLoopFilePath(ResultToken &aResultToken, LPTSTR aPattern, LPTSTR aPrefix, size_t aPrefixLen, LPTSTR aSuffix, size_t aSuffixLen) |
| 10192 | { |
no outgoing calls
no test coverage detected