Clear modsToInstall earlier

Dataflow is now more clear.

The `std::vector` is cleared earlyer, so there is a bit less memory
used.
This commit is contained in:
phosit
2024-10-08 19:59:36 +02:00
committed by phosit
parent 3c8f6762c8
commit 48d1b7586d
+2 -4
View File
@@ -658,7 +658,8 @@ static void RunGameOrAtlas(const PS::span<const char* const> argv)
CModInstaller installer(paths.UserData() / "mods", paths.Cache());
// Install the mods without deleting the pyromod files
for (const OsPath& modPath : modsToInstall)
// `modsToInstall` is cleared so we don't intstall the mods again on restart.
for (const OsPath& modPath : std::exchange(modsToInstall, {}))
{
CModInstaller::ModInstallationResult result = installer.Install(modPath, g_ScriptContext, true);
if (result != CModInstaller::ModInstallationResult::SUCCESS)
@@ -701,9 +702,6 @@ static void RunGameOrAtlas(const PS::span<const char* const> argv)
NonVisualFrame();
}
// Do not install mods again in case of restart (typically from the mod selector)
modsToInstall.clear();
ShutdownNetworkAndUI();
guiScriptInterface.reset();
ShutdownConfigAndSubsequent();