mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
Added support for skipping the scanning of game system subdirectories
This commit is contained in:
parent
a5b1b17c2c
commit
196e0d1031
|
@ -49,6 +49,7 @@ FileData::FileData(FileType type,
|
|||
, mUpdateChildrenLastPlayed {false}
|
||||
, mUpdateChildrenMostPlayed {false}
|
||||
, mDeletionFlag {false}
|
||||
, mNoLoad {false}
|
||||
{
|
||||
// Metadata needs at least a name field (since that's what getName() will return).
|
||||
if ((system->hasPlatformId(PlatformIds::ARCADE) ||
|
||||
|
|
|
@ -97,6 +97,8 @@ public:
|
|||
|
||||
const bool getDeletionFlag() const { return mDeletionFlag; }
|
||||
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; }
|
||||
void refreshMetadata() { metadata = mSourceFileData->metadata; }
|
||||
|
||||
|
@ -184,6 +186,7 @@ private:
|
|||
bool mUpdateChildrenMostPlayed;
|
||||
// Used for flagging a game for deletion from its gamelist.xml file.
|
||||
bool mDeletionFlag;
|
||||
bool mNoLoad;
|
||||
};
|
||||
|
||||
class CollectionFileData : public FileData
|
||||
|
|
|
@ -59,6 +59,9 @@ namespace GamelistFileParser
|
|||
if (found)
|
||||
treeNode = children.at(key);
|
||||
|
||||
if (treeNode->getNoLoad())
|
||||
return nullptr;
|
||||
|
||||
// This is the end.
|
||||
if (path_it == --pathList.end()) {
|
||||
if (found)
|
||||
|
@ -132,12 +135,21 @@ namespace GamelistFileParser
|
|||
if (!Utils::FileSystem::exists(xmlpath)) {
|
||||
LOG(LogDebug) << "GamelistFileParser::parseGamelist(): System \"" << system->getName()
|
||||
<< "\" 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;
|
||||
}
|
||||
|
||||
if (Utils::FileSystem::getFileSize(xmlpath) == 0) {
|
||||
LOG(LogWarning) << "GamelistFileParser::parseGamelist(): System \"" << system->getName()
|
||||
<< "\" has an empty gamelist.xml file";
|
||||
for (auto child : system->getRootFolder()->getChildrenRecursive()) {
|
||||
if (child->getNoLoad())
|
||||
delete child;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)};
|
||||
populateFolder(newFolder);
|
||||
|
||||
|
|
Loading…
Reference in a new issue