Fix infinite recursion on non-existing directory

This commit is contained in:
goeiecool9999 2022-09-09 12:09:59 +02:00 committed by klaas
parent 97b5622705
commit 14aa8aaf63

View File

@ -7,7 +7,11 @@ fs::path findPathCI(const fs::path& path)
fs::path fName = path.filename();
fs::path parentPath = path.parent_path();
if (!fs::exists(parentPath))
return findPathCI(findPathCI(parentPath) / fName);
{
auto CIParent = findPathCI(parentPath);
if (fs::exists(CIParent))
return findPathCI(CIParent / fName);
}
std::error_code listErr;
for (auto&& dirEntry : fs::directory_iterator(parentPath, listErr))