From f112222fae5424a6b203e81fe4b7358e60cdaf93 Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Thu, 4 Mar 2021 16:18:20 -0800 Subject: [PATCH] Qt/MemoryCardEditor: Prevent duplicate filenames when copying saves --- src/duckstation-qt/memorycardeditordialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/duckstation-qt/memorycardeditordialog.cpp b/src/duckstation-qt/memorycardeditordialog.cpp index f0ddb65d3..cbb529ddd 100644 --- a/src/duckstation-qt/memorycardeditordialog.cpp +++ b/src/duckstation-qt/memorycardeditordialog.cpp @@ -331,6 +331,19 @@ void MemoryCardEditorDialog::doCopyFile() Card* dst = (src == &m_card_a) ? &m_card_b : &m_card_a; + for (const MemoryCardImage::FileInfo& dst_fi : dst->files) + { + if (dst_fi.filename == fi->filename) + { + QMessageBox::critical( + this, tr("Error"), + tr("Destination memory card already contains a save file with the same name (%1) as the one you are attempting " + "to copy. Please delete this file from the destination memory card before copying.") + .arg(QString(fi->filename.c_str()))); + return; + } + } + if (dst->blocks_free < fi->num_blocks) { QMessageBox::critical(this, tr("Error"),