From 858ae7cd4f382bf9620a4d7b2d04132b59042828 Mon Sep 17 00:00:00 2001 From: Yutaka Sawada <60930312+Yutaka-Sawada@users.noreply.github.com> Date: Fri, 28 Jul 2023 21:54:05 +0900 Subject: [PATCH 1/2] enable Recurse flag on Windows OS --- src/diskfile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/diskfile.cpp b/src/diskfile.cpp index 5b8df0aa..a8376344 100644 --- a/src/diskfile.cpp +++ b/src/diskfile.cpp @@ -397,7 +397,8 @@ 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 ((0 != (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) && + (recursive == true)) { if (fd.cFileName[0] == '.') { continue; @@ -408,6 +409,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)); From 6b0695e4169c3718d187f3483023d6ea8c634c74 Mon Sep 17 00:00:00 2001 From: Yutaka Sawada <60930312+Yutaka-Sawada@users.noreply.github.com> Date: Fri, 28 Jul 2023 22:02:13 +0900 Subject: [PATCH 2/2] Check recurse flag simply --- src/diskfile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/diskfile.cpp b/src/diskfile.cpp index a8376344..875cdc77 100644 --- a/src/diskfile.cpp +++ b/src/diskfile.cpp @@ -397,8 +397,7 @@ std::unique_ptr< list > DiskFile::FindFiles(string path, string wildcard { matches->push_back(path + fd.cFileName); } - else if ((0 != (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) && - (recursive == true)) + else if (recursive == true) { if (fd.cFileName[0] == '.') { continue;