Added support for skipping the scanning of game system subdirectories

This commit is contained in:
Leon Styhre 2024-07-10 22:42:25 +02:00
parent a5b1b17c2c
commit 196e0d1031
4 changed files with 30 additions and 0 deletions

View file

@ -49,6 +49,7 @@ FileData::FileData(FileType type,
, mUpdateChildrenLastPlayed {false} , mUpdateChildrenLastPlayed {false}
, mUpdateChildrenMostPlayed {false} , mUpdateChildrenMostPlayed {false}
, mDeletionFlag {false} , mDeletionFlag {false}
, mNoLoad {false}
{ {
// Metadata needs at least a name field (since that's what getName() will return). // Metadata needs at least a name field (since that's what getName() will return).
if ((system->hasPlatformId(PlatformIds::ARCADE) || if ((system->hasPlatformId(PlatformIds::ARCADE) ||

View file

@ -97,6 +97,8 @@ public:
const bool getDeletionFlag() const { return mDeletionFlag; } const bool getDeletionFlag() const { return mDeletionFlag; }
void setDeletionFlag(bool setting) { mDeletionFlag = setting; } void setDeletionFlag(bool setting) { mDeletionFlag = setting; }
const bool getNoLoad() const { return mNoLoad; }
void setNoLoad(bool state) { mNoLoad = state; }
const bool isPlaceHolder() const { return mType == PLACEHOLDER; } const bool isPlaceHolder() const { return mType == PLACEHOLDER; }
void refreshMetadata() { metadata = mSourceFileData->metadata; } void refreshMetadata() { metadata = mSourceFileData->metadata; }
@ -184,6 +186,7 @@ private:
bool mUpdateChildrenMostPlayed; bool mUpdateChildrenMostPlayed;
// Used for flagging a game for deletion from its gamelist.xml file. // Used for flagging a game for deletion from its gamelist.xml file.
bool mDeletionFlag; bool mDeletionFlag;
bool mNoLoad;
}; };
class CollectionFileData : public FileData class CollectionFileData : public FileData

View file

@ -59,6 +59,9 @@ namespace GamelistFileParser
if (found) if (found)
treeNode = children.at(key); treeNode = children.at(key);
if (treeNode->getNoLoad())
return nullptr;
// This is the end. // This is the end.
if (path_it == --pathList.end()) { if (path_it == --pathList.end()) {
if (found) if (found)
@ -132,12 +135,21 @@ namespace GamelistFileParser
if (!Utils::FileSystem::exists(xmlpath)) { if (!Utils::FileSystem::exists(xmlpath)) {
LOG(LogDebug) << "GamelistFileParser::parseGamelist(): System \"" << system->getName() LOG(LogDebug) << "GamelistFileParser::parseGamelist(): System \"" << system->getName()
<< "\" does not have a gamelist.xml file"; << "\" does not have a gamelist.xml file";
// Get rid of any orphaned noload.txt folder entries.
for (auto child : system->getRootFolder()->getChildrenRecursive()) {
if (child->getNoLoad())
delete child;
}
return; return;
} }
if (Utils::FileSystem::getFileSize(xmlpath) == 0) { if (Utils::FileSystem::getFileSize(xmlpath) == 0) {
LOG(LogWarning) << "GamelistFileParser::parseGamelist(): System \"" << system->getName() LOG(LogWarning) << "GamelistFileParser::parseGamelist(): System \"" << system->getName()
<< "\" has an empty gamelist.xml file"; << "\" has an empty gamelist.xml file";
for (auto child : system->getRootFolder()->getChildrenRecursive()) {
if (child->getNoLoad())
delete child;
}
return; return;
} }
@ -296,6 +308,11 @@ namespace GamelistFileParser
} }
} }
} }
// Get rid of any orphaned noload.txt folder entries.
for (auto child : system->getRootFolder()->getChildrenRecursive()) {
if (child->getNoLoad())
delete child;
}
} }
} }

View file

@ -418,6 +418,15 @@ bool SystemData::populateFolder(FileData* folder)
} }
} }
if (Utils::FileSystem::exists(filePath + "/noload.txt")) {
LOG(LogInfo) << "Skipped folder \"" << filePath
<< "\" as a noload.txt file is present";
FileData* newFolder {new FileData(FOLDER, filePath, mEnvData, this)};
newFolder->setNoLoad(true);
folder->addChild(newFolder);
continue;
}
FileData* newFolder {new FileData(FOLDER, filePath, mEnvData, this)}; FileData* newFolder {new FileData(FOLDER, filePath, mEnvData, this)};
populateFolder(newFolder); populateFolder(newFolder);