Fix crash when permissions are missing up the tree.

This commit is contained in:
goeiecool9999 2022-09-07 16:28:35 +02:00 committed by klaas
parent d3ce33486d
commit 9bc33de652

View file

@ -248,7 +248,8 @@ class fscDeviceHostFSC : public fscDeviceC {
for (auto const &it : relPath) for (auto const &it : relPath)
{ {
found = false; found = false;
for (auto const& dir_entry : std::filesystem::directory_iterator{correctedPath}) std::error_code listErr;
for (auto const& dir_entry : std::filesystem::directory_iterator{correctedPath, listErr})
{ {
std::filesystem::path entry_name = dir_entry.path().filename(); std::filesystem::path entry_name = dir_entry.path().filename();
if (lowercase_path(entry_name) == lowercase_path(it)) if (lowercase_path(entry_name) == lowercase_path(it))
@ -258,6 +259,14 @@ class fscDeviceHostFSC : public fscDeviceC {
break; break;
} }
} }
// if we can't iterate directory, just copy the original case.
if(listErr)
{
correctedPath /= it;
found = true;
}
if (!found) if (!found)
break; break;
} }