Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remote mods directory #403

Merged
merged 3 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions NorthstarDLL/mods/modmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions NorthstarDLL/mods/modmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class ModManager
};

fs::path GetModFolderPath();
fs::path GetRemoteModFolderPath();
fs::path GetCompiledAssetsPath();

extern ModManager* g_pModManager;