Fixed an issue on Unix where hidden games folders would crash the application.

This commit is contained in:
Leon Styhre 2020-07-26 15:21:41 +02:00
parent e2bd5d05b1
commit 496e653ae7
3 changed files with 15 additions and 2 deletions

View file

@ -44,4 +44,6 @@ v1.0.0
* Toggling the screensaver didn't work as expected
* Deleting a game did not delete the game media files or its entry in the gamelist.xml file
* SystemView didn't properly loop the systems if only two systems were available
* Hidden files still showed up if they had a gamelist.xml entry
* On Unix, adding a hidden folder with a game in it crashed the application on startup
* Lots and lots of small bugs and inconsistencies fixed

View file

@ -51,7 +51,16 @@ FileData::FileData(
MameNames::getInstance()->getCleanName(getCleanName()));
}
else {
#ifdef __unix__
if (metadata.getType() == FOLDER_METADATA && Utils::FileSystem::isHidden(mPath)) {
metadata.set("name", Utils::FileSystem::getFileName(mPath));
}
else {
metadata.set("name", getDisplayName());
}
#else
metadata.set("name", getDisplayName());
#endif
}
}
mSystemName = system->getName();

View file

@ -132,8 +132,10 @@ void parseGamelist(SystemData* system)
continue;
}
// Skip hidden files and folders.
if (!showHiddenFiles && Utils::FileSystem::isHidden(path)) {
// Skip hidden files, check both the file itself and the directory in which
// it is located.
if (!showHiddenFiles && (Utils::FileSystem::isHidden(path) ||
Utils::FileSystem::isHidden(Utils::FileSystem::getParent(path)))) {
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden file " << path;
continue;
}