From de0d8595025bc577a6baeb2b621170c37f311cce Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 30 Jul 2023 13:35:48 +1000 Subject: [PATCH] Qt: Fix changing cover file formats --- pcsx2-qt/MainWindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index 4e7e75d052..5ec8c825d4 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -2285,7 +2285,8 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry) if (filename.isEmpty()) return; - if (!GameList::GetCoverImagePathForEntry(entry).empty()) + const QString old_filename = QString::fromStdString(GameList::GetCoverImagePathForEntry(entry)); + if (!old_filename.isEmpty()) { if (QMessageBox::question(this, tr("Cover Already Exists"), tr("A cover image for this game already exists, do you wish to replace it?"), QMessageBox::Yes, @@ -2311,6 +2312,12 @@ void MainWindow::setGameListEntryCoverImage(const GameList::Entry* entry) return; } + if (!old_filename.isEmpty() && old_filename != new_filename && !QFile::remove(old_filename)) + { + QMessageBox::critical(this, tr("Copy Error"), tr("Failed to remove '%1'").arg(old_filename)); + return; + } + m_game_list_widget->refreshGridCovers(); }