From cacd8d471fc437a81043ee63f9afb79b70ad7826 Mon Sep 17 00:00:00 2001 From: goeiecool9999 <> Date: Thu, 8 Sep 2022 14:04:40 +0200 Subject: [PATCH] fix something and use boost:iequal like cemu does elsewhere --- src/Cafe/Filesystem/FSPath.cpp | 13 +------------ src/Cafe/Filesystem/FSPath.h | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Cafe/Filesystem/FSPath.cpp b/src/Cafe/Filesystem/FSPath.cpp index 9ddbaf02..8806216d 100644 --- a/src/Cafe/Filesystem/FSPath.cpp +++ b/src/Cafe/Filesystem/FSPath.cpp @@ -22,17 +22,6 @@ FSPath& FSPath::operator/= (const FSPath & rhs) fs::path relPath = rhs.relative_path(); 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; for (auto const &it : relPath) { @@ -41,7 +30,7 @@ FSPath& FSPath::operator/= (const FSPath & rhs) for (auto const& dirEntry : fs::directory_iterator{correctedPath, listErr}) { fs::path entryName = dirEntry.path().filename(); - if (lowercase_path(entryName) == lowercase_path(it)) + if (boost::iequals(entryName, it)) { correctedPath /= entryName; found = true; diff --git a/src/Cafe/Filesystem/FSPath.h b/src/Cafe/Filesystem/FSPath.h index bbccaa32..c7fe3e5b 100644 --- a/src/Cafe/Filesystem/FSPath.h +++ b/src/Cafe/Filesystem/FSPath.h @@ -8,12 +8,12 @@ class FSPath : public fs::path { template FSPath(const T& other) : fs::path(other) {}; -#ifdef BOOST_OS_UNIX template static FSPath Convert(const T& input) { return FSPath{} / FSPath{input}; } +#ifdef BOOST_OS_UNIX FSPath& operator/= (const FSPath & rhs); FSPath& operator/ (const FSPath & rhs); #endif