diff --git a/src/diskfile.cpp b/src/diskfile.cpp index 5b8df0aa..875cdc77 100644 --- a/src/diskfile.cpp +++ b/src/diskfile.cpp @@ -397,7 +397,7 @@ std::unique_ptr< list > DiskFile::FindFiles(string path, string wildcard { matches->push_back(path + fd.cFileName); } - else if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + else if (recursive == true) { if (fd.cFileName[0] == '.') { continue; @@ -408,6 +408,10 @@ std::unique_ptr< list > DiskFile::FindFiles(string path, string wildcard DiskFile::FindFiles(path + fd.cFileName, nwwildcard, true) ); + // sort both lists before merge + matches->sort(); + dirmatches->sort(); + matches->merge(*dirmatches); } } while (::FindNextFile(h, &fd));