aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/modmanager.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-28 04:16:20 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-28 04:16:20 +0100
commita5a937d19fcb51fe4168345d09596784e174726e (patch)
tree08eaf40ed362348c1ea187a477b71f70c6fe74a1 /NorthstarDedicatedTest/modmanager.cpp
parent5ed2fbecaa3a96b69b97d889a28bd2f96fcf2572 (diff)
downloadNorthstarLauncher-a5a937d19fcb51fe4168345d09596784e174726e.tar.gz
NorthstarLauncher-a5a937d19fcb51fe4168345d09596784e174726e.zip
improve lookup speeds for mod files
Diffstat (limited to 'NorthstarDedicatedTest/modmanager.cpp')
-rw-r--r--NorthstarDedicatedTest/modmanager.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp
index ea16f591..964d37ae 100644
--- a/NorthstarDedicatedTest/modmanager.cpp
+++ b/NorthstarDedicatedTest/modmanager.cpp
@@ -248,13 +248,15 @@ void ModManager::LoadMods()
{
for (fs::directory_entry file : fs::recursive_directory_iterator(m_loadedMods[i]->ModDirectory / MOD_OVERRIDE_DIR))
{
- if (file.is_regular_file())
+ fs::path path = file.path().lexically_relative(m_loadedMods[i]->ModDirectory / MOD_OVERRIDE_DIR).lexically_normal();
+
+ if (file.is_regular_file() && m_modFiles.find(path.string()) == m_modFiles.end())
{
// super temp because it relies hard on load order
ModOverrideFile* modFile = new ModOverrideFile;
modFile->owningMod = m_loadedMods[i];
- modFile->path = file.path().lexically_relative(m_loadedMods[i]->ModDirectory / MOD_OVERRIDE_DIR).lexically_normal();
- m_modFiles.push_back(modFile);
+ modFile->path = path;
+ m_modFiles.insert(std::make_pair(path.string(), modFile));
}
}
}