diff options
author | Rémy Raes <contact@remyraes.com> | 2023-01-30 11:44:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-30 10:44:37 +0000 |
commit | d418217e0ac6ada2217d5e5171f6baa3707380c9 (patch) | |
tree | a1e8609a2997600f03899cc231d7f82042d09b85 /NorthstarDLL/mods | |
parent | 2c02e7bc6a8055c5950a5ec8cb2fb40c6513436b (diff) | |
download | NorthstarLauncher-d418217e0ac6ada2217d5e5171f6baa3707380c9.tar.gz NorthstarLauncher-d418217e0ac6ada2217d5e5171f6baa3707380c9.zip |
feat: Remote mods directory (#403)
* feat: create remote mod directory
* feat: look for mods in remote mods directory
Diffstat (limited to 'NorthstarDLL/mods')
-rw-r--r-- | NorthstarDLL/mods/modmanager.cpp | 15 | ||||
-rw-r--r-- | NorthstarDLL/mods/modmanager.h | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index a47aa854..38966236 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -354,6 +354,7 @@ void ModManager::LoadMods() // ensure dirs exist fs::remove_all(GetCompiledAssetsPath()); fs::create_directories(GetModFolderPath()); + fs::create_directories(GetRemoteModFolderPath()); m_DependencyConstants.clear(); @@ -374,9 +375,13 @@ void ModManager::LoadMods() } // get mod directories - for (fs::directory_entry dir : fs::directory_iterator(GetModFolderPath())) - if (fs::exists(dir.path() / "mod.json")) - modDirs.push_back(dir.path()); + std::filesystem::directory_iterator classicModsDir = fs::directory_iterator(GetModFolderPath()); + std::filesystem::directory_iterator remoteModsDir = fs::directory_iterator(GetRemoteModFolderPath()); + + for (std::filesystem::directory_iterator modIterator : {classicModsDir, remoteModsDir}) + for (fs::directory_entry dir : modIterator) + if (fs::exists(dir.path() / "mod.json")) + modDirs.push_back(dir.path()); for (fs::path modDir : modDirs) { @@ -805,6 +810,10 @@ fs::path GetModFolderPath() { return fs::path(GetNorthstarPrefix() + MOD_FOLDER_SUFFIX); } +fs::path GetRemoteModFolderPath() +{ + return fs::path(GetNorthstarPrefix() + REMOTE_MOD_FOLDER_SUFFIX); +} fs::path GetCompiledAssetsPath() { return fs::path(GetNorthstarPrefix() + COMPILED_ASSETS_SUFFIX); diff --git a/NorthstarDLL/mods/modmanager.h b/NorthstarDLL/mods/modmanager.h index ded6ff06..c2335d09 100644 --- a/NorthstarDLL/mods/modmanager.h +++ b/NorthstarDLL/mods/modmanager.h @@ -161,6 +161,7 @@ class ModManager }; fs::path GetModFolderPath(); +fs::path GetRemoteModFolderPath(); fs::path GetCompiledAssetsPath(); extern ModManager* g_pModManager; |