Fixed an issue where the application could hand when clearing or deleting a game if there were insufficient permissions

This commit is contained in:
Leon Styhre 2023-04-08 14:04:17 +02:00
parent e9cd5dfd84
commit fba314ad04

View file

@ -663,28 +663,32 @@ void GamelistBase::removeMedia(FileData* game)
while (Utils::FileSystem::exists(game->getVideoPath())) { while (Utils::FileSystem::exists(game->getVideoPath())) {
mediaType = "videos"; mediaType = "videos";
path = game->getVideoPath(); path = game->getVideoPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getMiximagePath())) { while (Utils::FileSystem::exists(game->getMiximagePath())) {
mediaType = "miximages"; mediaType = "miximages";
path = game->getMiximagePath(); path = game->getMiximagePath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getScreenshotPath())) { while (Utils::FileSystem::exists(game->getScreenshotPath())) {
mediaType = "screenshots"; mediaType = "screenshots";
path = game->getScreenshotPath(); path = game->getScreenshotPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getTitleScreenPath())) { while (Utils::FileSystem::exists(game->getTitleScreenPath())) {
mediaType = "titlescreens"; mediaType = "titlescreens";
path = game->getTitleScreenPath(); path = game->getTitleScreenPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
@ -698,35 +702,40 @@ void GamelistBase::removeMedia(FileData* game)
while (Utils::FileSystem::exists(game->getBackCoverPath())) { while (Utils::FileSystem::exists(game->getBackCoverPath())) {
mediaType = "backcovers"; mediaType = "backcovers";
path = game->getBackCoverPath(); path = game->getBackCoverPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getFanArtPath())) { while (Utils::FileSystem::exists(game->getFanArtPath())) {
mediaType = "fanart"; mediaType = "fanart";
path = game->getFanArtPath(); path = game->getFanArtPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getMarqueePath())) { while (Utils::FileSystem::exists(game->getMarqueePath())) {
mediaType = "marquees"; mediaType = "marquees";
path = game->getMarqueePath(); path = game->getMarqueePath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->get3DBoxPath())) { while (Utils::FileSystem::exists(game->get3DBoxPath())) {
mediaType = "3dboxes"; mediaType = "3dboxes";
path = game->get3DBoxPath(); path = game->get3DBoxPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getPhysicalMediaPath())) { while (Utils::FileSystem::exists(game->getPhysicalMediaPath())) {
mediaType = "physicalmedia"; mediaType = "physicalmedia";
path = game->getPhysicalMediaPath(); path = game->getPhysicalMediaPath();
Utils::FileSystem::removeFile(path); if (Utils::FileSystem::removeFile(path))
break;
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
} }