fix something and use boost:iequal like cemu does elsewhere

This commit is contained in:
goeiecool9999 2022-09-08 14:04:40 +02:00 committed by klaas
parent 9f2b5bf0f8
commit cacd8d471f
2 changed files with 2 additions and 13 deletions

View file

@ -22,17 +22,6 @@ FSPath& FSPath::operator/= (const FSPath & rhs)
fs::path relPath = rhs.relative_path(); fs::path relPath = rhs.relative_path();
fs::path correctedPath = empty() ? rhs.root_path() : *this; fs::path correctedPath = empty() ? rhs.root_path() : *this;
// helper function to convert a path's alphabet characters to lowercase.
auto static lowercase_path = [](fs::path const & path)
{
std::string string = path.string();
for (auto& i : string)
{
i = std::isalpha(i) ? std::tolower(i) : i;
}
return string;
};
bool found; bool found;
for (auto const &it : relPath) for (auto const &it : relPath)
{ {
@ -41,7 +30,7 @@ FSPath& FSPath::operator/= (const FSPath & rhs)
for (auto const& dirEntry : fs::directory_iterator{correctedPath, listErr}) for (auto const& dirEntry : fs::directory_iterator{correctedPath, listErr})
{ {
fs::path entryName = dirEntry.path().filename(); fs::path entryName = dirEntry.path().filename();
if (lowercase_path(entryName) == lowercase_path(it)) if (boost::iequals(entryName, it))
{ {
correctedPath /= entryName; correctedPath /= entryName;
found = true; found = true;

View file

@ -8,12 +8,12 @@ class FSPath : public fs::path {
template <class T> template <class T>
FSPath(const T& other) : fs::path(other) {}; FSPath(const T& other) : fs::path(other) {};
#ifdef BOOST_OS_UNIX
template <class T> template <class T>
static FSPath Convert(const T& input) static FSPath Convert(const T& input)
{ {
return FSPath{} / FSPath{input}; return FSPath{} / FSPath{input};
} }
#ifdef BOOST_OS_UNIX
FSPath& operator/= (const FSPath & rhs); FSPath& operator/= (const FSPath & rhs);
FSPath& operator/ (const FSPath & rhs); FSPath& operator/ (const FSPath & rhs);
#endif #endif