Fixed an issue where stale gamelist entries could get displayed.

This commit is contained in:
Leon Styhre 2021-12-22 18:53:29 +01:00
parent 68f40f7247
commit c2d3719edf

View file

@ -44,7 +44,7 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
treeNode = children.at(key);
}
// This is the end
// This is the end.
if (path_it == --pathList.end()) {
if (found)
return treeNode;
@ -54,6 +54,19 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
return nullptr;
}
// Handle the special situation where a file exists and has an entry in the
// gamelist.xml file but the file extension is not configured in es_systems.xml.
const std::vector<std::string> extensions =
system->getSystemEnvData()->mSearchExtensions;
if (std::find(extensions.cbegin(), extensions.cend(),
Utils::FileSystem::getExtension(path)) == extensions.cend()) {
LOG(LogWarning) << "File \"" << path
<< "\" is present in gamelist.xml but the extension is not "
"configured in es_systems.xml";
return nullptr;
}
FileData* file = new FileData(type, path, system->getSystemEnvData(), system);
// Skipping arcade assets from gamelist.