mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Use filesystem equivalence when checking if a plugin is the game master
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include <thread>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/locale.hpp>
|
||||
|
||||
#include "api/api_database.h"
|
||||
#include "api/helpers/logging.h"
|
||||
@@ -161,6 +160,7 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
if (logger) {
|
||||
logger->trace("Starting plugin loading.");
|
||||
}
|
||||
auto masterPath = DataPath() / u8path(masterFilename_);
|
||||
vector<thread> threads;
|
||||
while (threads.size() < threadsToUse) {
|
||||
vector<string>& pluginGroup = pluginGroups[threads.size()];
|
||||
@@ -169,12 +169,12 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
if (logger) {
|
||||
logger->trace("Loading {}", pluginName);
|
||||
}
|
||||
auto pluginPath = DataPath() / u8path(pluginName);
|
||||
const bool loadHeader =
|
||||
loadHeadersOnly ||
|
||||
boost::locale::to_lower(pluginName) == lowercasedMasterFilename_;
|
||||
loadHeadersOnly || loot::equivalent(pluginPath, masterPath);
|
||||
try {
|
||||
cache_->AddPlugin(Plugin(
|
||||
Type(), cache_, loadOrderHandler_, DataPath() / u8path(pluginName), loadHeader));
|
||||
Type(), cache_, loadOrderHandler_, pluginPath, loadHeader));
|
||||
} catch (std::exception& e) {
|
||||
if (logger) {
|
||||
logger->error(
|
||||
@@ -211,7 +211,7 @@ std::set<std::shared_ptr<const PluginInterface>> Game::GetLoadedPlugins()
|
||||
}
|
||||
|
||||
void Game::IdentifyMainMasterFile(const std::string& masterFile) {
|
||||
lowercasedMasterFilename_ = boost::locale::to_lower(masterFile);
|
||||
masterFilename_ = masterFile;
|
||||
}
|
||||
|
||||
std::vector<std::string> Game::SortPlugins(
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ private:
|
||||
const GameType type_;
|
||||
const std::filesystem::path gamePath_;
|
||||
|
||||
std::string lowercasedMasterFilename_;
|
||||
std::string masterFilename_;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user