Ignore main exe path for group loading when loading data from planet/ subfolder

This fixes a slowdown in scenario selection when some of the dependency folders (e.g. qt) are searched for scenarios.

Should also fix a bug where music is loaded from the exe path instead of planet/ if present
install-platforms
Sven Eberhardt 2017-07-11 20:43:21 -07:00
parent 8dffeadc56
commit aa7c964fab
1 changed files with 17 additions and 3 deletions

View File

@ -35,10 +35,24 @@ void C4Reloc::Init()
StdCopyStrBuf planet(Config.General.ExePath);
planet.AppendBackslash();
planet.Append("planet");
AddPath(planet.getData());
if (DirectoryExists(planet.getData()))
{
// Only add planet if it's a valid contents folder.
// Because users may create a folder "planet" in their source repos.
StdCopyStrBuf planet_system_check(planet);
planet_system_check.AppendBackslash();
planet_system_check.Append(C4CFN_System);
if (ItemExists(planet_system_check.getData()))
{
AddPath(planet.getData());
}
}
#endif
// Add main system path
AddPath(Config.General.SystemDataPath);
// Add main system path (unless it's using planet/ anyway, in which we would just slow down scenario enumeration by looking throug hthe whole source folder)
if (!Paths.size())
{
AddPath(Config.General.SystemDataPath);
}
// Add user path for additional data (player files, user scenarios, etc.)
AddPath(Config.General.UserDataPath, PATH_PreferredInstallationLocation);
}