Fixed some log messages when using a noload.txt file for a subdirectory

This commit is contained in:
Leon Styhre 2024-07-10 23:56:36 +02:00
parent 196e0d1031
commit bb9b09ef89
2 changed files with 20 additions and 8 deletions

View file

@ -60,7 +60,7 @@ namespace GamelistFileParser
treeNode = children.at(key); treeNode = children.at(key);
if (treeNode->getNoLoad()) if (treeNode->getNoLoad())
return nullptr; return treeNode;
// This is the end. // This is the end.
if (path_it == --pathList.end()) { if (path_it == --pathList.end()) {
@ -68,9 +68,11 @@ namespace GamelistFileParser
return treeNode; return treeNode;
if (type == FOLDER) { if (type == FOLDER) {
LOG(LogWarning) << "A folder defined in gamelist.xml does not exist or " if (!Utils::FileSystem::exists(path + "/noload.txt")) {
"contains no valid games: \"" LOG(LogWarning) << "A folder defined in gamelist.xml does not exist or "
<< path << "\""; "contains no valid games: \""
<< path << "\"";
}
return nullptr; return nullptr;
} }
@ -243,6 +245,9 @@ namespace GamelistFileParser
FileData* file {findOrCreateFile(system, path, type)}; FileData* file {findOrCreateFile(system, path, type)};
if (file != nullptr && file->getNoLoad())
continue;
// Don't load entries with the wrong type. This should very rarely (if ever) happen. // Don't load entries with the wrong type. This should very rarely (if ever) happen.
if (file != nullptr && ((tag == "game" && file->getType() == FOLDER) || if (file != nullptr && ((tag == "game" && file->getType() == FOLDER) ||
(tag == "folder" && file->getType() == GAME))) { (tag == "folder" && file->getType() == GAME))) {
@ -252,13 +257,15 @@ namespace GamelistFileParser
} }
if (!file) { if (!file) {
if (!Utils::FileSystem::exists(path + "/noload.txt")) {
#if defined(_WIN64) #if defined(_WIN64)
LOG(LogWarning) LOG(LogWarning)
<< "Couldn't process \"" << Utils::String::replace(path, "/", "\\") << "Couldn't process \"" << Utils::String::replace(path, "/", "\\")
<< "\", skipping entry"; << "\", skipping entry";
#else #else
LOG(LogWarning) << "Couldn't process \"" << path << "\", skipping entry"; LOG(LogWarning) << "Couldn't process \"" << path << "\", skipping entry";
#endif #endif
}
continue; continue;
} }
else if (!file->isArcadeAsset()) { else if (!file->isArcadeAsset()) {

View file

@ -419,8 +419,13 @@ bool SystemData::populateFolder(FileData* folder)
} }
if (Utils::FileSystem::exists(filePath + "/noload.txt")) { if (Utils::FileSystem::exists(filePath + "/noload.txt")) {
#if defined(_WIN64)
LOG(LogInfo) << "Skipped folder \"" << Utils::String::replace(filePath, "/", "\\")
<< "\" as a noload.txt file is present";
#else
LOG(LogInfo) << "Skipped folder \"" << filePath LOG(LogInfo) << "Skipped folder \"" << filePath
<< "\" as a noload.txt file is present"; << "\" as a noload.txt file is present";
#endif
FileData* newFolder {new FileData(FOLDER, filePath, mEnvData, this)}; FileData* newFolder {new FileData(FOLDER, filePath, mEnvData, this)};
newFolder->setNoLoad(true); newFolder->setNoLoad(true);
folder->addChild(newFolder); folder->addChild(newFolder);