Scenario list loader: Ignore .ocd and .ocg files when looking recursively for scenarios

install-platforms
Sven Eberhardt 2017-07-11 20:45:57 -07:00
parent 17153c6fbe
commit 0c50e81413
2 changed files with 6 additions and 0 deletions

View File

@ -164,6 +164,7 @@
#define C4CFN_TempLeagueInfo "~league.tmp"
#define C4CFN_DefFiles "*.ocd"
#define C4CFN_GenericGroupFiles "*.ocg"
#define C4CFN_PlayerFiles "*.ocp"
#define C4CFN_MaterialFiles "*.ocm"
#define C4CFN_ObjectInfoFiles "*.oci"

View File

@ -524,6 +524,11 @@ bool C4ScenarioListLoader::Entry::Load(C4Group *pFromGrp, const StdStrBuf *psFil
// helper func: Recursive check whether a directory contains a .ocs or .ocf file
bool DirContainsScenarios(const char *szDir)
{
// Ignore object and group folders to avoid descending e.g. deep into unpacked Objects.ocd
if (WildcardMatch(C4CFN_DefFiles, szDir) || WildcardMatch(C4CFN_GenericGroupFiles, szDir))
{
return false;
}
// create iterator on free store to avoid stack overflow with deeply recursed folders
DirectoryIterator *pIter = new DirectoryIterator(szDir);
const char *szChildFilename;