@@ -113,8 +113,9 @@ void ModManager::LoadMods()
113
113
114
114
// ensure dirs exist
115
115
fs::remove_all (GetCompiledAssetsPath ());
116
- fs::create_directories (GetModFolderPath ());
117
- fs::create_directories (GetThunderstoreModFolderPath ());
116
+ fs::create_directories (GetCoreModFolderPath ());
117
+ fs::create_directories (GetManualModFolderPath ());
118
+ fs::create_directories (GetThunderstoreLegacyModFolderPath ());
118
119
fs::create_directories (GetRemoteModFolderPath ());
119
120
120
121
m_DependencyConstants.clear ();
@@ -526,14 +527,29 @@ void ModManager::SearchFilesystemForMods()
526
527
m_LoadedMods.clear ();
527
528
528
529
// get mod directories
529
- std::filesystem::directory_iterator classicModsDir = fs::directory_iterator (GetModFolderPath ());
530
+ std::filesystem::directory_iterator coreModsDir = fs::directory_iterator (GetCoreModFolderPath ());
531
+ std::filesystem::directory_iterator manualModsDir = fs::directory_iterator (GetManualModFolderPath ());
530
532
std::filesystem::directory_iterator remoteModsDir = fs::directory_iterator (GetRemoteModFolderPath ());
531
- std::filesystem::directory_iterator thunderstoreModsDir = fs::directory_iterator (GetThunderstoreModFolderPath ());
533
+ std::filesystem::directory_iterator thunderstoreModsDir = fs::directory_iterator (GetThunderstoreLegacyModFolderPath ());
532
534
533
- for (fs::directory_entry dir : classicModsDir)
535
+ // Set up regex for `Northstar.*` pattern
536
+ std::regex northstar_pattern (R"( .*\\Northstar\..+)" );
537
+ for (fs::directory_entry dir : coreModsDir)
538
+ {
539
+ if (!std::regex_match (dir.path ().string (), northstar_pattern))
540
+ {
541
+ spdlog::warn (
542
+ " The following directory did not match 'Northstar.*' and is most likely an incorrectly manually installed mod: {}" ,
543
+ dir.path ().string ());
544
+ continue ; // skip loading mod that doesn't match
545
+ }
534
546
if (fs::exists (dir.path () / " mod.json" ))
535
547
modDirs.push_back (dir.path ());
548
+ }
536
549
550
+ for (fs::directory_entry dir : manualModsDir)
551
+ if (fs::exists (dir.path () / " mod.json" ))
552
+ modDirs.push_back (dir.path ());
537
553
// Special case for Thunderstore and remote mods directories
538
554
// Set up regex for `AUTHOR-MOD-VERSION` pattern
539
555
std::regex pattern (R"( .*\\([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)-(\d+\.\d+\.\d+))" );
@@ -673,13 +689,17 @@ void ConCommand_reload_mods(const CCommand& args)
673
689
g_pModManager->LoadMods ();
674
690
}
675
691
676
- fs::path GetModFolderPath ()
692
+ fs::path GetCoreModFolderPath ()
693
+ {
694
+ return fs::path (GetNorthstarPrefix () + CORE_MOD_FOLDER_SUFFIX);
695
+ }
696
+ fs::path GetManualModFolderPath ()
677
697
{
678
698
return fs::path (GetNorthstarPrefix () + MOD_FOLDER_SUFFIX);
679
699
}
680
- fs::path GetThunderstoreModFolderPath ()
700
+ fs::path GetThunderstoreLegacyModFolderPath ()
681
701
{
682
- return fs::path (GetNorthstarPrefix () + THUNDERSTORE_MOD_FOLDER_SUFFIX );
702
+ return fs::path (GetNorthstarPrefix () + THUNDERSTORE_LEGACY_MOD_FOLDER_SUFFIX );
683
703
}
684
704
fs::path GetRemoteModFolderPath ()
685
705
{
0 commit comments