When deleting important files like savedata or games, move to trash.

This currently only works on Windows, where it changes the Delete button
to "Move to trash".
This commit is contained in:
Henrik Rydgård committed 2025-04-10 09:02:44 +02:00
1 parent 69b2f7d9b6
commit 7712cf5331
49 files changed
+72 -20

No files matched your search

+1 -1
View File
@@ -1688,7 +1688,7 @@ bool Config::deleteGameConfig(const std::string& pGameId) {
Path fullIniFilePath = Path(getGameConfigFile(pGameId, &exists));
if (exists) {
File::Delete(fullIniFilePath);
File::MoveFileToTrashOrDelete(fullIniFilePath);
}
return true;
}
+9 -7
View File
@@ -94,7 +94,7 @@ bool GameInfo::Delete() {
// Just delete the one file (TODO: handle two-disk games as well somehow).
Path fileToRemove = filePath_;
INFO_LOG(Log::System, "Deleting file %s", fileToRemove.c_str());
File::Delete(fileToRemove);
File::MoveFileToTrashOrDelete(fileToRemove);
g_recentFiles.Remove(filePath_.ToString());
return true;
}
@@ -108,14 +108,14 @@ bool GameInfo::Delete() {
// This can happen if the PBP is misplaced, see issue #20187
if (!IsReasonableEbootDirectory(directoryToRemove)) {
// Just delete the eboot.
File::Delete(filePath_);
File::MoveFileToTrashOrDelete(filePath_);
g_recentFiles.Remove(filePath_.ToString());
return true;
}
// Delete the whole tree. We better be sure, see IsReasonableEbootDirectory.
INFO_LOG(Log::System, "Deleting directory %s", directoryToRemove.c_str());
if (!File::DeleteDirRecursively(directoryToRemove)) {
if (!File::MoveDirectoryTreeToTrashOrDelete(directoryToRemove)) {
ERROR_LOG(Log::System, "Failed to delete file");
return false;
}
@@ -133,7 +133,7 @@ bool GameInfo::Delete() {
{
const Path &fileToRemove = filePath_;
INFO_LOG(Log::System, "Deleting file %s", fileToRemove.c_str());
File::Delete(fileToRemove);
File::MoveFileToTrashOrDelete(fileToRemove);
g_recentFiles.Remove(filePath_.ToString());
return true;
}
@@ -142,10 +142,10 @@ bool GameInfo::Delete() {
{
const Path &ppstPath = filePath_;
INFO_LOG(Log::System, "Deleting file %s", ppstPath.c_str());
File::Delete(ppstPath);
File::MoveFileToTrashOrDelete(ppstPath);
const Path screenshotPath = filePath_.WithReplacedExtension(".ppst", ".jpg");
if (File::Exists(screenshotPath)) {
File::Delete(screenshotPath);
File::MoveFileToTrashOrDelete(screenshotPath);
}
return true;
}
@@ -331,7 +331,9 @@ bool GameInfo::DeleteAllSaveData() {
std::vector<Path> saveDataDir = GetSaveDataDirectories();
for (size_t j = 0; j < saveDataDir.size(); j++) {
INFO_LOG(Log::System, "Deleting savedata from %s", saveDataDir[j].c_str());
File::DeleteDirRecursively(saveDataDir[j]);
if (!File::MoveDirectoryTreeToTrashOrDelete(saveDataDir[j])) {
ERROR_LOG(Log::System, "Failed to delete savedata %s", saveDataDir[j].c_str());
}
}
return true;
}
+1 -1
View File
@@ -85,7 +85,7 @@ public:
GameInfo(const Path &gamePath);
~GameInfo();
bool Delete(); // Better be sure what you're doing when calling this.
bool Delete(); // Better be sure what you're doing when calling this. Will move to trash if available on the system, though.
bool DeleteAllSaveData();
bool CreateLoader();
+6 -3
View File
@@ -323,8 +323,9 @@ UI::EventReturn GameScreen::OnCreateConfig(UI::EventParams &e) {
UI::EventReturn GameScreen::OnDeleteConfig(UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
const bool trashAvailable = System_GetPropertyBool(SYSPROP_HAS_TRASH_BIN);
screenManager()->push(
new PromptScreen(gamePath_, di->T("DeleteConfirmGameConfig", "Do you really want to delete the settings for this game?"), di->T("Delete"), di->T("Cancel"),
new PromptScreen(gamePath_, di->T("DeleteConfirmGameConfig", "Do you really want to delete the settings for this game?"), trashAvailable ? di->T("Move to trash") : di->T("Delete"), di->T("Cancel"),
[this](bool result) {
if (result) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath_, GameInfoFlags::PARAM_SFO);
@@ -533,9 +534,10 @@ UI::EventReturn GameScreen::OnDeleteSaveData(UI::EventParams &e) {
if (info) {
// Check that there's any savedata to delete
if (info->saveDataSize) {
const bool trashAvailable = System_GetPropertyBool(SYSPROP_HAS_TRASH_BIN);
auto di = GetI18NCategory(I18NCat::DIALOG);
screenManager()->push(
new PromptScreen(gamePath_, di->T("DeleteConfirmAll", "Do you really want to delete all\nyour save data for this game?"), di->T("Delete"), di->T("Cancel"),
new PromptScreen(gamePath_, di->T("DeleteConfirmAll", "Do you really want to delete all\nyour save data for this game?"), trashAvailable ? di->T("Move to trash") : di->T("Delete"), di->T("Cancel"),
std::bind(&GameScreen::CallbackDeleteSaveData, this, std::placeholders::_1)));
}
}
@@ -559,8 +561,9 @@ UI::EventReturn GameScreen::OnDeleteGame(UI::EventParams &e) {
std::string prompt;
prompt = di->T("DeleteConfirmGame", "Do you really want to delete this game\nfrom your device? You can't undo this.");
prompt += "\n\n" + gamePath_.ToVisualString(g_Config.memStickDirectory.c_str());
const bool trashAvailable = System_GetPropertyBool(SYSPROP_HAS_TRASH_BIN);
screenManager()->push(
new PromptScreen(gamePath_, prompt, di->T("Delete"), di->T("Cancel"),
new PromptScreen(gamePath_, prompt, trashAvailable ? di->T("Move to trash") : di->T("Delete"), di->T("Cancel"),
std::bind(&GameScreen::CallbackDeleteGame, this, std::placeholders::_1)));
}
return UI::EVENT_DONE;
+4 -1
View File
@@ -172,8 +172,11 @@ public:
buttonRow->Add(new Button(di->T("Delete"), new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Add([this](UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
std::shared_ptr<GameInfo> ginfo = g_gameInfoCache->GetInfo(nullptr, savePath_, GameInfoFlags::PARAM_SFO);
const bool trashAvailable = System_GetPropertyBool(SYSPROP_HAS_TRASH_BIN);
std::string_view confirmMessage = di->T("Are you sure you want to delete the file?");
screenManager()->push(new PromptScreen(gamePath_, confirmMessage, di->T("Delete"), di->T("Cancel"), [=](bool result) {
screenManager()->push(new PromptScreen(gamePath_, confirmMessage, trashAvailable ? di->T("Move to trash") : di->T("Delete"), di->T("Cancel"), [=](bool result) {
if (result) {
ginfo->Delete();
TriggerFinish(DR_NO);
+1
View File
@@ -434,6 +434,7 @@ Logging in... = جاري تسجيل الدخول...
More information... = المزيد من المعلومات
Move = ‎تحريك
Move Down = تحريك للأسفل
Move to trash = Move to trash
Move Up = تحريك للأعلى
Network Connection = ‎إتصال الشبكة
NEW DATA = ‎بيانات جديدة
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = NEW DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Преместване
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Мрежова връзка
NEW DATA = Нови данни
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Moure
Move Down = Baixar
Move to trash = Move to trash
Move Up = Pujar
Network Connection = Connexión de xarxa
NEW DATA = NOVES DADES DE PARTIDA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Přesunout
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Síťové připojení
NEW DATA = NOVÁ DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Flyt
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Netværksforbindelse
NEW DATA = NY DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Bewegen
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Netzwerkverbindung
NEW DATA = Neue Daten
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = DATA baru
+3 -2
View File
@@ -416,8 +416,8 @@ Delete = Delete
Delete all = Delete all
Delete completed = Delete completed.
DeleteConfirm = This save data will be deleted.\nAre you sure you want to continue?
DeleteConfirmAll = Do you really want to delete all\nyour save data for this game?
DeleteConfirmGame = Do you really want to delete this game\nfrom your device? You can't undo this.
DeleteConfirmAll = Do you really want to delete all your save data for this game?
DeleteConfirmGame = Do you really want to delete this game from your device? You can't undo this.
DeleteConfirmGameConfig = Do you really want to delete the settings for this game?
DeleteFailed = Unable to delete data.
Deleting = Deleting\nPlease wait...
@@ -449,6 +449,7 @@ Logging in... = Logging in...
Logged in! = Logged in!
More information... = More information...
Move = Move
Move to trash = Move to trash
Move Up = Move Up
Move Down = Move Down
Network Connection = Network Connection
+1
View File
@@ -427,6 +427,7 @@ Logging in... = Iniciando sesión...
More information... = Más información...
Move = Mover
Move Down = Mover abajo
Move to trash = Move to trash
Move Up = Mover arriba
Network Connection = Conexión de red
NEW DATA = NUEVOS DATOS
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = Más información...
Move = Mover
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Conexión de red
NEW DATA = CREAR DATOS
+1
View File
@@ -426,6 +426,7 @@ Logging in... = وارد شدن...
More information... = اطلاعات بیشتر...
Move = حرکت
Move Down = حرکت به پایین
Move to trash = Move to trash
Move Up = حرکت به بالا
Network Connection = Network Connection
NEW DATA = ‎دادهٔ جدید
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = NEW DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Déplacer
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Connexion réseau
NEW DATA = NOUVELLES DONNÉES
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Posición
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Conexión de rede
NEW DATA = NOVOS DATOS
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = ΜΕΤΑΚΙΝΗΣΗ
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = ΣΥΝΔΕΣΗ ΔΙΚΤΥΟΥ
NEW DATA = ΝΕΑ ΔΕΔΟΜΕΝΑ
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = םישדח םינותנ
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = םישדח םינותנ
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Pomakni
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Internetska veza
NEW DATA = NOVA DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Bejelentkezés...
More information... = További információ...
Move = Mozgat
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Hálózati kapcsolat
NEW DATA = ÚJ MENTÉS
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Masuk...
More information... = Informasi selengkapnya...
Move = Pindah
Move Down = Pindah ke Bawah
Move to trash = Move to trash
Move Up = Naik ke Atas
Network Connection = Koneksi Jaringan
NEW DATA = DATA BARU
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Accesso in corso...
More information... = Altre informazioni...
Move = Sposta
Move Down = Sposta giù
Move to trash = Move to trash
Move Up = Sposta su
Network Connection = Connessione di Rete
NEW DATA = NUOVI DATI
+1
View File
@@ -426,6 +426,7 @@ Logging in... = ログイン中...
More information... = 詳細はこちら...
Move = 移動
Move Down = 下へ移動
Move to trash = Move to trash
Move Up = 上へ移動
Network Connection = ネットワーク接続
NEW DATA = 新しいデータ
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Pindahno
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Koneksi Jaringan
NEW DATA = DATA ANYAR
+1
View File
@@ -425,6 +425,7 @@ Logging in... = 로그인 중...
Logged in! = 로그인했습니다!
More information... = 추가 정보...
Move = 이동
Move to trash = Move to trash
Move Up = 위로 이동
Move Down = 아래로 이동
Network Connection = 네트워크 연결
+1
View File
@@ -439,6 +439,7 @@ Logging in... = Logging in...
Logged in! = Logged in!
More information... = More information...
Move = Move
Move to trash = Move to trash
Move Up = Move Up
Move Down = Move Down
Network Connection = Network Connection
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = ເຄື່ອນຍ້າຍ
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = ການເຊື່ອມຕໍ່ເຄື່ອຂ່າຍ
NEW DATA = ຂໍ້ມູນໃໝ່
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Perkelti
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Interneto tinklas
NEW DATA = NAUJI DUOMENYS
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = DATA BAHARU
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Slepen
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Netwerkverbinding
NEW DATA = NIEUWE DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Move
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Network Connection
NEW DATA = NEW DATA
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logowanie...
More information... = Więcej informacji...
Move = Przenieś
Move Down = Przenieś w dół
Move to trash = Move to trash
Move Up = Przenieś w górę
Network Connection = Połączenie sieciowe
NEW DATA = NOWE DANE
+1
View File
@@ -449,6 +449,7 @@ Logging in... = Logando...
Logged in! = Logado!
More information... = Mais informação...
Move = Mover
Move to trash = Move to trash
Move Up = Mover pra Cima
Move Down = Mover pra Baixo
Network Connection = Conexão de rede
+1
View File
@@ -450,6 +450,7 @@ Logging in... = A cadastrar...
More information... = More information...
Move = Mover
Move Down = Mover para baixo
Move to trash = Move to trash
Move Up = Mover para cima
Network Connection = Conexão de rede
NEW DATA = NOVOS DADOS
+1
View File
@@ -427,6 +427,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Mișcă
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Conexiune la rețea
NEW DATA = DATE NOI
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Вход...
More information... = More information...
Move = Положение
Move Down = Сдвинуть вверх
Move to trash = Move to trash
Move Up = Сдвинуть вниз
Network Connection = Сетевое подключение
NEW DATA = Новое сохранение
+6 -5
View File
@@ -364,7 +364,7 @@ VFPU = VFPU
%d minutes = %d minuter
%d ms = %d ms
%d seconds = %d sekunder
* PSP res = * PSP res
* PSP res = * PSP upplösning
Active = Aktiv
Are you sure you want to delete the file? = Är du säker på att du vill ta bort filen?
Are you sure you want to exit? = Är du säker på att du vill avsluta?
@@ -388,7 +388,7 @@ ConnectionName = Anslutningsnamn
Copied to clipboard: %1 = Kopierat till urklipp: %1
Copy to clipboard = Kopiera till urklipp
Corrupted Data = Korrupt data
#Default = Default
#Default = Standard
Delete = Radera
Delete all = Radera allt
Delete completed = Borttaget.
@@ -410,8 +410,8 @@ Failed to connect to server, check your internet connection. = Misslyckades med
Failed to log in, check your username and password. = Misslyckades med att logga in, kontrollera ditt användarnamn och lösenord.
Filter = Filtrera
Finish = Färdig
GE Frame Dumps = GE-framedumper
Grid = Grid
GE Frame Dumps = GE-framedumpar
Grid = Rutnät
Inactive = Inaktiv
Installing... = Installerar...
InternalError = Ett internt fel har upptäckts.
@@ -427,12 +427,13 @@ Logging in... = Loggar in...
More information... = Mer information...
Move = Flytta
Move Down = Flytta ner
Move to trash = Flytta till papperskorgen
Move Up = Flytta upp
Network Connection = Nätverksanslutning
NEW DATA = NY DATA
No = Nej
None = Ingen
ObtainingIP = Hämtar IP-address.\nVänta...
ObtainingIP = Hämtar IP-adress.\nVänta...
OK = OK
Old savedata detected = Gammal sparad data upptäckt
Options = Inställningar
+1
View File
@@ -427,6 +427,7 @@ Logging in... = Nag-lologin na...
More information... = Iba pang impormasyon...
Move = Galawin
Move Down = Galawin pababa
Move to trash = Move to trash
Move Up = Galawin paitaas
Network Connection = Koneksyon ng Network
NEW DATA = BAGONG DATOS
+1
View File
@@ -436,6 +436,7 @@ Logging in... = กำลังเข้าใช้งาน...
More information... = ข้อมูลเพิ่มเติม...
Move = ย้าย
Move Down = ย้ายลงล่าง
Move to trash = Move to trash
Move Up = ย้ายขึ้นบน
Network Connection = การเชื่อมต่อเครือข่าย
NEW DATA = ข้อมูลใหม่
+1
View File
@@ -428,6 +428,7 @@ Logging in... = Giriş yapılıyor...
More information... = Daha fazla bilgi...
Move = Taşı
Move Down = Aşağı Taşı
Move to trash = Move to trash
Move Up = Yukarı Taşı
Network Connection = Ağ Bağlantısı
NEW DATA = YENİ VERİ
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Вхід...
More information... = Більше інформації...
Move = Положення
Move Down = Рух вниз
Move to trash = Move to trash
Move Up = Рух вгору
Network Connection = Підключення до мережі
NEW DATA = Нове збереження
+1
View File
@@ -426,6 +426,7 @@ Logging in... = Logging in...
More information... = More information...
Move = Di chuyển
Move Down = Move Down
Move to trash = Move to trash
Move Up = Move Up
Network Connection = Kết nối mạng
NEW DATA = DỮ LIỆU MỚI
+1
View File
@@ -426,6 +426,7 @@ Logging in... = 登录中…
More information... = 了解更多...
Move = 移动位置
Move Down = 移至下层
Move to trash = Move to trash
Move Up = 移至上层
Network Connection = 网络连接
NEW DATA = 新建存档
+1
View File
@@ -426,6 +426,7 @@ Logging in... = 正在登入…
More information... = 更多資訊…
Move = 移動
Move Down = 下移
Move to trash = Move to trash
Move Up = 上移
Network Connection = 網路連線
NEW DATA = 新存檔