diff --git a/es-app/src/Gamelist.cpp b/es-app/src/Gamelist.cpp index b302c17e1..55838ed94 100644 --- a/es-app/src/Gamelist.cpp +++ b/es-app/src/Gamelist.cpp @@ -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.