mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-07-10 01:24:41 -06:00
Handle permission error. parrent -> parent
This commit is contained in:
parent
fb789419c3
commit
9fc2d8b158
@ -5,18 +5,20 @@ std::optional<fs::path> findPathCI(const fs::path& path)
|
||||
{
|
||||
if (fs::exists(path)) return path;
|
||||
if (!path.has_parent_path()) return {};
|
||||
auto parrentPath = path.parent_path();
|
||||
if (!fs::exists(parrentPath))
|
||||
auto parentPath = path.parent_path();
|
||||
if (!fs::exists(parentPath))
|
||||
{
|
||||
auto tempParrentPath = findPathCI(parrentPath);
|
||||
if (tempParrentPath.has_value())
|
||||
parrentPath = std::move(tempParrentPath.value());
|
||||
auto tempParentPath = findPathCI(parentPath);
|
||||
if (tempParentPath.has_value())
|
||||
parentPath = std::move(tempParentPath.value());
|
||||
else
|
||||
return {};
|
||||
}
|
||||
std::wstring fName = path.filename().wstring();
|
||||
if (fs::exists(parrentPath))
|
||||
for (auto&& dirEntry : fs::directory_iterator(parrentPath))
|
||||
if (fs::exists(parentPath))
|
||||
{
|
||||
std::error_code listErr;
|
||||
for (auto&& dirEntry: fs::directory_iterator(parentPath, listErr))
|
||||
{
|
||||
std::wstring dirFName = dirEntry.path().filename().wstring();
|
||||
if (boost::iequals(dirFName, fName, std::locale::classic()))
|
||||
@ -24,7 +26,10 @@ std::optional<fs::path> findPathCI(const fs::path& path)
|
||||
return dirEntry;
|
||||
}
|
||||
}
|
||||
return parrentPath / fName;
|
||||
if (listErr)
|
||||
return fName;
|
||||
}
|
||||
return parentPath / fName;
|
||||
}
|
||||
|
||||
FileStream* FileStream::openFile(std::string_view path)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user