Changed GuiOrphanedDataCleanup to not purge some folder entries if hidden games are not shown

This commit is contained in:
Leon Styhre 2023-10-18 17:56:27 +02:00
parent 8cea8e3783
commit 15c06b0d4c

View file

@ -440,6 +440,12 @@ void GuiOrphanedDataCleanup::cleanupGamelists()
{ {
LOG(LogInfo) << "GuiOrphanedDataCleanup: Starting cleanup of gamelist.xml files"; LOG(LogInfo) << "GuiOrphanedDataCleanup: Starting cleanup of gamelist.xml files";
if (!Settings::getInstance()->getBool("ShowHiddenGames")) {
LOG(LogWarning)
<< "The \"Show hidden games\" setting is disabled, this may lead to some orphaned "
"folder entries not getting purged";
}
const std::time_t currentTime { const std::time_t currentTime {
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())}; std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())};
@ -595,6 +601,10 @@ void GuiOrphanedDataCleanup::cleanupGamelists()
++removeCount; ++removeCount;
} }
} }
else if (!Settings::getInstance()->getBool("ShowHiddenGames")) {
// Don't remove entries for existing folders if not displaying hidden games.
targetRoot.append_copy((*it));
}
else { else {
bool folderExists {false}; bool folderExists {false};
for (auto child : system->getRootFolder()->getChildrenRecursive()) { for (auto child : system->getRootFolder()->getChildrenRecursive()) {