From d4273d698523f7b8966bbee83beecc8131a21678 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Fri, 5 Jul 2024 23:11:58 +0200 Subject: feat: Require core Northstar mods to be formatted starting with `Northstar.` in their mod name --- primedev/mods/modmanager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) 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")) -- cgit v1.2.3