From 496e653ae7337da9d95f77f85605b7568c3286df Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 26 Jul 2020 15:21:41 +0200 Subject: [PATCH] Fixed an issue on Unix where hidden games folders would crash the application. --- NEWS.md | 2 ++ es-app/src/FileData.cpp | 9 +++++++++ es-app/src/Gamelist.cpp | 6 ++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index b84a783ac..a7eddecf4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index a1b846817..904c8f694 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -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(); diff --git a/es-app/src/Gamelist.cpp b/es-app/src/Gamelist.cpp index 680d9f5e1..fe7e2d855 100644 --- a/es-app/src/Gamelist.cpp +++ b/es-app/src/Gamelist.cpp @@ -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; }