aboutsummaryrefslogtreecommitdiff
path: root/primedev
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2024-07-05 21:10:16 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2024-07-05 21:10:16 +0200
commit02c22d71624e567a770b9faa352ed0da3c39104f (patch)
tree8150e7ab0c648328613b48f8813d4f227285511c /primedev
parentf5707e2b36a338961b3dabfde1c1668304f6ae66 (diff)
downloadNorthstarLauncher-02c22d71624e567a770b9faa352ed0da3c39104f.tar.gz
NorthstarLauncher-02c22d71624e567a770b9faa352ed0da3c39104f.zip
feat: Add support for manual mods folder
Diffstat (limited to 'primedev')
-rw-r--r--primedev/mods/modmanager.cpp10
-rw-r--r--primedev/mods/modmanager.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/primedev/mods/modmanager.cpp b/primedev/mods/modmanager.cpp
index b2a7e713..90f54449 100644
--- a/primedev/mods/modmanager.cpp
+++ b/primedev/mods/modmanager.cpp
@@ -616,6 +616,7 @@ void ModManager::LoadMods()
// ensure dirs exist
fs::remove_all(GetCompiledAssetsPath());
fs::create_directories(GetCoreModFolderPath());
+ fs::create_directories(GetManualModFolderPath());
fs::create_directories(GetThunderstoreLegacyModFolderPath());
fs::create_directories(GetRemoteModFolderPath());
@@ -639,6 +640,7 @@ void ModManager::LoadMods()
// get mod directories
std::filesystem::directory_iterator coreModsDir = fs::directory_iterator(GetCoreModFolderPath());
+ std::filesystem::directory_iterator manualModsDir = fs::directory_iterator(GetManualModFolderPath());
std::filesystem::directory_iterator remoteModsDir = fs::directory_iterator(GetRemoteModFolderPath());
std::filesystem::directory_iterator thunderstoreModsDir = fs::directory_iterator(GetThunderstoreLegacyModFolderPath());
@@ -646,6 +648,10 @@ void ModManager::LoadMods()
if (fs::exists(dir.path() / "mod.json"))
modDirs.push_back(dir.path());
+ for (fs::directory_entry dir : manualModsDir)
+ if (fs::exists(dir.path() / "mod.json"))
+ modDirs.push_back(dir.path());
+
// Special case for Thunderstore and remote mods directories
// Set up regex for `AUTHOR-MOD-VERSION` pattern
std::regex pattern(R"(.*\\([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)-(\d+\.\d+\.\d+))");
@@ -1131,6 +1137,10 @@ fs::path GetCoreModFolderPath()
{
return fs::path(GetNorthstarPrefix() + CORE_MOD_FOLDER_SUFFIX);
}
+fs::path GetManualModFolderPath()
+{
+ return fs::path(GetNorthstarPrefix() + MANUAL_MOD_FOLDER_SUFFIX);
+}
fs::path GetThunderstoreLegacyModFolderPath()
{
return fs::path(GetNorthstarPrefix() + THUNDERSTORE_MOD_FOLDER_SUFFIX);
diff --git a/primedev/mods/modmanager.h b/primedev/mods/modmanager.h
index ace79e32..517b33a7 100644
--- a/primedev/mods/modmanager.h
+++ b/primedev/mods/modmanager.h
@@ -10,6 +10,7 @@
#include <unordered_set>
const std::string CORE_MOD_FOLDER_SUFFIX = "\\mods\\core";
+const std::string MANUAL_MOD_FOLDER_SUFFIX = "\\mods\\manual";
const std::string THUNDERSTORE_MOD_FOLDER_SUFFIX = "\\mods\\thunderstore-legacy";
const std::string REMOTE_MOD_FOLDER_SUFFIX = "\\runtime\\remote\\mods";
const fs::path MOD_OVERRIDE_DIR = "mod";
@@ -180,6 +181,7 @@ public:
};
fs::path GetCoreModFolderPath();
+fs::path GetManualModFolderPath();
fs::path GetRemoteModFolderPath();
fs::path GetThunderstoreLegacyModFolderPath();
fs::path GetCompiledAssetsPath();