diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-07-05 23:11:58 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-07-05 23:11:58 +0200 |
commit | d4273d698523f7b8966bbee83beecc8131a21678 (patch) | |
tree | a346de8d17efa0d3157b28bdb0a32b7f268469a8 | |
parent | 2d57c5d0ce5fffdf99e84fb5be6a24c9b1eed708 (diff) | |
download | NorthstarLauncher-d4273d698523f7b8966bbee83beecc8131a21678.tar.gz NorthstarLauncher-d4273d698523f7b8966bbee83beecc8131a21678.zip |
feat: Require core Northstar mods to be formatted starting with `Northstar.` in their mod name
-rw-r--r-- | primedev/mods/modmanager.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/primedev/mods/modmanager.cpp b/primedev/mods/modmanager.cpp index f0ddb0f5..b99c8761 100644 --- a/primedev/mods/modmanager.cpp +++ b/primedev/mods/modmanager.cpp @@ -644,9 +644,20 @@ void ModManager::LoadMods() std::filesystem::directory_iterator remoteModsDir = fs::directory_iterator(GetRemoteModFolderPath()); std::filesystem::directory_iterator thunderstoreModsDir = fs::directory_iterator(GetThunderstoreLegacyModFolderPath()); + // Set up regex for `Northstar.*` pattern + std::regex northstar_pattern(R"(.*\\Northstar\..+)"); for (fs::directory_entry dir : coreModsDir) + { + if (!std::regex_match(dir.path().string(), northstar_pattern)) + { + spdlog::warn( + "The following directory did not match 'Northstar.*' and is most likely an incorrectly manually installed mod: {}", + dir.path().string()); + continue; // skip loading mod that doesn't match + } 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")) |