GOB: do not add anymore all subdirectories to the search path in Adibou2

Only "envir", "applis", and any directory containing an "intro_ap.stk" file (indicates an Adibou/Adi application directory).
This commit is contained in:
Simon Delamarre 2022-11-28 22:34:52 +01:00 committed by Eugene Sandulenko
parent 5d519ed33b
commit bf652277aa
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -34,8 +34,25 @@ Init_v7::~Init_v7() {
void Init_v7::initGame() {
const Common::FSNode gameDataDir(ConfMan.get("path"));
// That way, an application can be added simply by copying it as a separate subdirectory, in the main game directory
SearchMan.addSubDirectoryMatching(gameDataDir, "*", 0, 4, true);
// Add the environment directory
SearchMan.addSubDirectoryMatching(gameDataDir, "envir");
// Add the application list directory
SearchMan.addSubDirectoryMatching(gameDataDir, "applis");
// Add additional applications directories (e.g. "Read/Count 4-5 years").
// We rely on the presence of an "intro_ap.itk" to determinate whether a subdirectory contains an applcation.
Common::FSList subdirs;
gameDataDir.getChildren(subdirs, Common::FSNode::kListDirectoriesOnly);
for (const Common::FSNode &subdirNode : subdirs) {
Common::FSDirectory subdir(subdirNode);
if (subdir.hasFile("intro_ap.stk")) {
debugC(1, kDebugFileIO, "Found Adibou/Adi application subdirectory \"%s\", adding it to the search path", subdir.getFSNode().getName().c_str());
SearchMan.addSubDirectoryMatching(gameDataDir, subdir.getFSNode().getName(), 0, 4, true);
}
}
Init::initGame();
}