diff options
-rw-r--r-- | c/ext.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -88,22 +88,20 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo WIN32_FIND_DATA fdata; FindHandle h = FindFirstFile(pat, &fdata); - do { + do if (fdata.cFileName[0] == L'.') - continue; - if (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + ; + else if (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { /* Recurse into directory. */ wchar_t root2[MAX_PATH]; Swprintf(root2, L"%s\\%s", root, fdata.cFileName); if (FindMatchingFile(file, root2, siEp, level+1)) return true; + } else if (MatchFileName(fdata.cFileName, siEp)) { + Swprintf(file, L"%s\\%s", root, fdata.cFileName); + return true; } - else /* Try to match file name. */ - if (MatchFileName(fdata.cFileName, siEp)) { - Swprintf(file, L"%s\\%s", root, fdata.cFileName); - return true; - } - } while (FindNextFile(h, &fdata)); + while (FindNextFile(h, &fdata)); if (GetLastError() != ERROR_NO_MORE_FILES) throw Win32Error(); |