mirror of https://github.com/PCSX2/pcsx2.git
Qt: Add a permission error dialog when converting memorycards in a R/O directory
This commit is contained in:
parent
95201409e3
commit
ac4d827a9c
|
@ -51,7 +51,7 @@ aa27e4454ce631c5a17924ce0624eac736da19fc6f5a2ab15a6c58da7b36950f shaderc-glslan
|
|||
03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
|
||||
EOF
|
||||
|
||||
curl -C - -L \
|
||||
curl -L \
|
||||
-O "https://github.com/ianlancetaylor/libbacktrace/archive/$LIBBACKTRACE.zip" \
|
||||
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
||||
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QtWidgets/QProgressDialog>
|
||||
|
||||
#include "common/Console.h"
|
||||
#include "common/Error.h"
|
||||
#include "common/Path.h"
|
||||
#include "common/StringUtil.h"
|
||||
|
||||
|
@ -262,6 +263,21 @@ void MemoryCardConvertDialog::ConvertCard()
|
|||
destName.append(StringUtil::StdStringFromFormat("_%02zd.ps2", ++num).c_str());
|
||||
}
|
||||
|
||||
// Check if we have write permission in the memory card directory
|
||||
const std::string destPath = Path::Combine(EmuFolders::MemoryCards, destName.toStdString());
|
||||
Error error;
|
||||
FILE* tmpFile = FileSystem::OpenCFile(destPath.c_str(), "w", &error);
|
||||
if (tmpFile == nullptr)
|
||||
{
|
||||
FileOpenError(error.GetDescription().c_str());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(tmpFile);
|
||||
FileSystem::DeleteFilePath(destPath.c_str());
|
||||
}
|
||||
|
||||
m_destCardName = destName;
|
||||
StartThread();
|
||||
}
|
||||
|
@ -303,3 +319,8 @@ void MemoryCardConvertDialog::SetType_Folder()
|
|||
{
|
||||
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, tr("Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card."));
|
||||
}
|
||||
|
||||
void MemoryCardConvertDialog::FileOpenError(const QString errmsg)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Cannot Convert Memory Card"),tr("There was an error when accessing the memory card directory. Error message: %0").arg(errmsg));
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ private:
|
|||
void SetType_32();
|
||||
void SetType_64();
|
||||
void SetType_Folder();
|
||||
void FileOpenError(const QString errmsg);
|
||||
|
||||
Ui::MemoryCardConvertDialog m_ui;
|
||||
|
||||
|
|
Loading…
Reference in New Issue