From 331c1a394a82e16a3fe3a0205f202ad4463b7a91 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 25 Jan 2020 16:19:25 +0100 Subject: [PATCH] Qt: Present game removal failure to the user All the required information was already there, but UI always reported success --- rpcs3/rpcs3qt/game_list_frame.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index abc5552a95..b56c51425a 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -1065,18 +1065,26 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) mb->deleteLater(); if (mb->exec() == QMessageBox::Yes) { - if (mb->checkBox()->isChecked()) + const bool remove_caches = mb->checkBox()->isChecked(); + if (fs::remove_all(currGame.path)) { - RemoveShadersCache(cache_base_dir); - RemovePPUCache(cache_base_dir); - RemoveSPUCache(cache_base_dir); - RemoveCustomConfiguration(currGame.serial); - RemoveCustomPadConfiguration(currGame.serial); + if (remove_caches) + { + RemoveShadersCache(cache_base_dir); + RemovePPUCache(cache_base_dir); + RemoveSPUCache(cache_base_dir); + RemoveCustomConfiguration(currGame.serial); + RemoveCustomPadConfiguration(currGame.serial); + } + m_game_data.erase(std::remove(m_game_data.begin(), m_game_data.end(), gameinfo), m_game_data.end()); + LOG_SUCCESS(GENERAL, "Removed %s %s in %s", currGame.category, currGame.name, currGame.path); + Refresh(true); + } + else + { + LOG_ERROR(GENERAL, "Failed to remove %s %s in %s (%s)", currGame.category, currGame.name, currGame.path, fs::g_tls_error); + QMessageBox::critical(this, tr("Failure!"), tr(remove_caches ? "Failed to remove %0 from drive!\nPath: %1\nCaches and custom configs have been left intact." : "Failed to remove %0 from drive!\nPath: %1").arg(name).arg(qstr(currGame.path))); } - fs::remove_all(currGame.path); - m_game_data.erase(std::remove(m_game_data.begin(), m_game_data.end(), gameinfo), m_game_data.end()); - LOG_SUCCESS(GENERAL, "Removed %s %s in %s", currGame.category, currGame.name, currGame.path); - Refresh(true); } }); connect(openGameFolder, &QAction::triggered, [=]()