mirror of
https://github.com/jorio/Pomme.git
synced 2025-02-17 07:32:11 +00:00
HostVolume: C++17 compat
This commit is contained in:
parent
1b5625e28e
commit
867c6af8f9
@ -171,7 +171,8 @@ static bool CaseInsensitiveAppendToPath(
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto ELEMENT = UppercaseCopy(element);
|
||||
// Convert path element to uppercase for case-insensitive comparisons
|
||||
const auto uppercaseElement = UppercaseCopy(element);
|
||||
|
||||
for (const auto& candidate : fs::directory_iterator(path))
|
||||
{
|
||||
@ -180,21 +181,24 @@ static bool CaseInsensitiveAppendToPath(
|
||||
continue;
|
||||
}
|
||||
|
||||
#if LEGACY_FILESYSTEM_IMPLEMENTATION // ghc::path::u8string returns an std::string
|
||||
std::string f = candidate.path().filename().u8string();
|
||||
#else
|
||||
auto f = FromU8(candidate.path().filename().u8string());
|
||||
#endif
|
||||
fs::path candidateFilename = candidate.path().filename();
|
||||
|
||||
// It might be an AppleDouble resource fork ("file.rsrc")
|
||||
if (candidate.is_regular_file() && f.ends_with(".rsrc"))
|
||||
if (candidate.is_regular_file() && candidateFilename.extension() == ".rsrc")
|
||||
{
|
||||
f = f.substr(0, f.length() - 5);
|
||||
candidateFilename.replace_extension("");
|
||||
}
|
||||
|
||||
if (ELEMENT == UppercaseCopy(f))
|
||||
// Convert candidate filename to uppercase for case-insensitive comparison
|
||||
#if LEGACY_FILESYSTEM_IMPLEMENTATION // ghc::path::u8string returns an std::string
|
||||
const std::string uppercaseCandidateFilename = UppercaseCopy(candidateFilename.u8string());
|
||||
#else // C++20
|
||||
const std::string uppercaseCandidateFilename = UppercaseCopy(FromU8(candidateFilename.u8string()));
|
||||
#endif
|
||||
|
||||
if (uppercaseElement == uppercaseCandidateFilename)
|
||||
{
|
||||
path /= AsU8(f);
|
||||
path /= candidateFilename;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user