From 421be5b01f92755226186e0c207789260fd040aa Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 17 Sep 2024 03:21:27 +0200 Subject: [PATCH] Added permissions check --- pcsx2-qt/Settings/MemoryCardConvertDialog.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pcsx2-qt/Settings/MemoryCardConvertDialog.cpp b/pcsx2-qt/Settings/MemoryCardConvertDialog.cpp index ab37b9d360..44f2235097 100644 --- a/pcsx2-qt/Settings/MemoryCardConvertDialog.cpp +++ b/pcsx2-qt/Settings/MemoryCardConvertDialog.cpp @@ -11,6 +11,8 @@ #include "common/Path.h" #include "common/StringUtil.h" +#include + MemoryCardConvertDialog::MemoryCardConvertDialog(QWidget* parent, QString selectedCard) : QDialog(parent) { @@ -253,6 +255,18 @@ void MemoryCardConvertDialog::ConvertCard() size_t num = 0; QString destName = baseName; destName.append(".ps2"); + + QString fullPath = Path::Combine(EmuFolders::MemoryCards, destName.toStdString()).c_str(); + QDir destinationDir(fullPath); + QString absolutePath = destinationDir.absolutePath(); // Get the absolute path + + if (access(absolutePath.toStdString().c_str(), R_OK | W_OK | X_OK) != 0) + { + QMessageBox::critical(this, tr("Cannot Convert Memory Card"), + tr("You have insufficient permissions to convert this Memory Card. Please ensure that you have read/write access to the folder \n \"%1\".") + .arg(absolutePath)); + return; + } // If a match is found, revert back to the base name, add a number and the extension, and try again. // Keep incrementing the number until we get a unique result.