diff --git a/common/FileSystem.cpp b/common/FileSystem.cpp index 6948d5bccb..34be64a1e8 100644 --- a/common/FileSystem.cpp +++ b/common/FileSystem.cpp @@ -1356,6 +1356,9 @@ static u32 TranslateWin32Attributes(u32 Win32Attributes) static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path, const char* path, const char* pattern, u32 flags, FileSystem::FindResultsArray* results, std::vector& visited, ProgressCallback* cancel) { + if (cancel && cancel->IsCancelled()) + return 0; + std::string search_dir; if (path) { @@ -1378,9 +1381,6 @@ static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path, if (hFind == INVALID_HANDLE_VALUE) return 0; - if (cancel && cancel->IsCancelled()) - return 0; - // small speed optimization for '*' case bool hasWildCards = false; bool wildCardMatchAll = false; @@ -2051,6 +2051,9 @@ static_assert(sizeof(off_t) == sizeof(s64)); static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, const char* Path, const char* Pattern, u32 Flags, FileSystem::FindResultsArray* pResults, std::vector& visited, ProgressCallback* cancel) { + if (cancel && cancel->IsCancelled()) + return 0; + std::string tempStr; if (Path) { @@ -2068,9 +2071,6 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co if (!pDir) return 0; - if (cancel && cancel->IsCancelled()) - return 0; - // small speed optimization for '*' case bool hasWildCards = false; bool wildCardMatchAll = false;