diff --git a/Source/File/FileEnumeration.cpp b/Source/File/FileEnumeration.cpp index 5962c9d49..eaee8d64c 100644 --- a/Source/File/FileEnumeration.cpp +++ b/Source/File/FileEnumeration.cpp @@ -16,11 +16,15 @@ void EnumerateFileNames(std::list& names, const char* directory, co const std::string current("."); const std::string parent(".."); - do { + if (current != found.cFileName && parent != found.cFileName) { + names.push_back(std::string(found.cFileName)); + } + + while (FindNextFileA(handle, &found)) { if (current != found.cFileName && parent != found.cFileName) { names.push_back(std::string(found.cFileName)); } - } while (FindNextFileA(handle, &found)); + } FindClose(handle); } @@ -38,10 +42,14 @@ void EnumerateFileNames(std::vector& names, const char* directory, const std::string current("."); const std::string parent(".."); - do { + if (current != found.cFileName && parent != found.cFileName) { + names.push_back(std::string(found.cFileName)); + } + + while (FindNextFileA(handle, &found)) { if (current != found.cFileName && parent != found.cFileName) { names.push_back(std::string(found.cFileName)); } - } while (FindNextFileA(handle, &found)); + } FindClose(handle); }