aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/filesystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/filesystem.cpp')
-rw-r--r--src/zencore/filesystem.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp
index 8e6f5085f..d18f21dbe 100644
--- a/src/zencore/filesystem.cpp
+++ b/src/zencore/filesystem.cpp
@@ -3112,15 +3112,22 @@ TEST_CASE("filesystem")
{
virtual void VisitFile(const std::filesystem::path& Parent, const path_view& File, uint64_t, uint32_t, uint64_t) override
{
- bFoundExpected |= std::filesystem::equivalent(Parent / File, Expected);
+ // std::filesystem::equivalent is *very* expensive on Windows, filter out unlikely candidates
+ if (ExpectedFilename == ToLower(std::filesystem::path(File).string()))
+ {
+ bFoundExpected |= std::filesystem::equivalent(Parent / File, Expected);
+ }
}
virtual bool VisitDirectory(const std::filesystem::path&, const path_view&, uint32_t) override { return true; }
- bool bFoundExpected = false;
+ bool bFoundExpected = false;
+
+ std::string ExpectedFilename;
std::filesystem::path Expected;
} Visitor;
- Visitor.Expected = BinPath;
+ Visitor.ExpectedFilename = ToLower(BinPath.filename().string());
+ Visitor.Expected = BinPath;
FileSystemTraversal().TraverseFileSystem(BinPath.parent_path().parent_path(), Visitor);
CHECK(Visitor.bFoundExpected);