diff --git a/src/api/game/game.cpp b/src/api/game/game.cpp index b6e31327..54f667fe 100644 --- a/src/api/game/game.cpp +++ b/src/api/game/game.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "api/api_database.h" #include "api/helpers/logging.h" @@ -169,7 +170,8 @@ void Game::LoadPlugins(const std::vector& plugins, logger->trace("Loading {}", pluginName); } const bool loadHeader = - boost::iequals(pluginName, masterFile_) || loadHeadersOnly; + loadHeadersOnly || + boost::locale::to_lower(pluginName) == lowercasedMasterFilename_; try { cache_->AddPlugin(Plugin( Type(), cache_, loadOrderHandler_, DataPath() / u8path(pluginName), loadHeader)); @@ -209,7 +211,7 @@ std::set> Game::GetLoadedPlugins() } void Game::IdentifyMainMasterFile(const std::string& masterFile) { - masterFile_ = masterFile; + lowercasedMasterFilename_ = boost::locale::to_lower(masterFile); } std::vector Game::SortPlugins( diff --git a/src/api/game/game.h b/src/api/game/game.h index c3592867..2c1eb136 100644 --- a/src/api/game/game.h +++ b/src/api/game/game.h @@ -86,7 +86,7 @@ private: const GameType type_; const std::filesystem::path gamePath_; - std::string masterFile_; + std::string lowercasedMasterFilename_; }; } #endif diff --git a/src/api/metadata/file.cpp b/src/api/metadata/file.cpp index dd9d8768..a50e7f2e 100644 --- a/src/api/metadata/file.cpp +++ b/src/api/metadata/file.cpp @@ -24,7 +24,7 @@ #include "loot/metadata/file.h" -#include +#include #include "api/metadata/yaml/file.h" @@ -39,11 +39,11 @@ File::File(const std::string& name, ConditionalMetadata(condition) {} bool File::operator<(const File& rhs) const { - return boost::ilexicographical_compare(GetName(), rhs.GetName()); + return boost::locale::to_lower(name_) < boost::locale::to_lower(rhs.name_); } bool File::operator==(const File& rhs) const { - return boost::iequals(GetName(), rhs.GetName()); + return boost::locale::to_lower(name_) == boost::locale::to_lower(rhs.name_); } std::string File::GetName() const { return name_; } diff --git a/src/api/metadata/plugin_metadata.cpp b/src/api/metadata/plugin_metadata.cpp index 89348f83..4b6a0c26 100644 --- a/src/api/metadata/plugin_metadata.cpp +++ b/src/api/metadata/plugin_metadata.cpp @@ -276,8 +276,9 @@ bool PluginMetadata::IsRegexPlugin() const { } bool PluginMetadata::operator==(const PluginMetadata& rhs) const { - if (IsRegexPlugin() == rhs.IsRegexPlugin()) - return boost::iequals(name_, rhs.GetName()); + if (IsRegexPlugin() == rhs.IsRegexPlugin()) { + return GetLowercasedName() == rhs.GetLowercasedName(); + } if (IsRegexPlugin()) return regex_match(rhs.GetName(), @@ -292,11 +293,7 @@ bool PluginMetadata::operator!=(const PluginMetadata& rhs) const { } bool PluginMetadata::operator==(const std::string& rhs) const { - if (IsRegexPlugin()) - return regex_match(PluginMetadata(rhs).GetName(), - regex(name_, regex::ECMAScript | regex::icase)); - else - return boost::iequals(name_, PluginMetadata(rhs).GetName()); + return *this == PluginMetadata(rhs); } bool PluginMetadata::operator!=(const std::string& rhs) const { diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 56063975..7bedb3dd 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -263,7 +263,7 @@ uintmax_t Plugin::GetFileSize(std::filesystem::path pluginPath) { } bool Plugin::operator<(const Plugin& rhs) const { - return boost::ilexicographical_compare(name_, rhs.name_); + return GetLowercasedName() < rhs.GetLowercasedName(); } bool Plugin::IsActive() const { return isActive_; } diff --git a/src/api/sorting/plugin_sorter.cpp b/src/api/sorting/plugin_sorter.cpp index cfa91abe..6c5587d2 100644 --- a/src/api/sorting/plugin_sorter.cpp +++ b/src/api/sorting/plugin_sorter.cpp @@ -275,9 +275,10 @@ void PluginSorter::AddPluginVertices(Game& game) { bool PluginSorter::GetVertexByName(const std::string& name, vertex_t& vertexOut) const { + auto lowercasedName = boost::locale::to_lower(name); for (const auto& vertex : boost::make_iterator_range(boost::vertices(graph_))) { - if (boost::iequals(graph_[vertex].GetName(), name)) { + if (graph_[vertex].GetLowercasedName() == lowercasedName) { vertexOut = vertex; return true; }