mirror of https://github.com/PCSX2/pcsx2.git
Merge 6e3e2400fb
into 5486eed151
This commit is contained in:
commit
0713565850
|
@ -51,7 +51,7 @@ aa27e4454ce631c5a17924ce0624eac736da19fc6f5a2ab15a6c58da7b36950f shaderc-glslan
|
||||||
03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
|
03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47 shaderc-spirv-tools-$SHADERC_SPIRVTOOLS.tar.gz
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
curl -C - -L \
|
curl -L \
|
||||||
-O "https://github.com/ianlancetaylor/libbacktrace/archive/$LIBBACKTRACE.zip" \
|
-O "https://github.com/ianlancetaylor/libbacktrace/archive/$LIBBACKTRACE.zip" \
|
||||||
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
-O "https://ijg.org/files/jpegsrc.v$LIBJPEG.tar.gz" \
|
||||||
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
-O "https://downloads.sourceforge.net/project/libpng/libpng16/$LIBPNG/libpng-$LIBPNG.tar.xz" \
|
||||||
|
|
|
@ -11,6 +11,14 @@
|
||||||
#include "common/Path.h"
|
#include "common/Path.h"
|
||||||
#include "common/StringUtil.h"
|
#include "common/StringUtil.h"
|
||||||
|
|
||||||
|
// Platform-specific includes
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
MemoryCardConvertDialog::MemoryCardConvertDialog(QWidget* parent, QString selectedCard)
|
MemoryCardConvertDialog::MemoryCardConvertDialog(QWidget* parent, QString selectedCard)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
|
@ -254,6 +262,38 @@ void MemoryCardConvertDialog::ConvertCard()
|
||||||
QString destName = baseName;
|
QString destName = baseName;
|
||||||
destName.append(".ps2");
|
destName.append(".ps2");
|
||||||
|
|
||||||
|
QString fullPath = Path::Combine(EmuFolders::MemoryCards, destName.toStdString()).c_str();
|
||||||
|
QDir destinationDir(fullPath);
|
||||||
|
QString absolutePath = destinationDir.absolutePath(); // Get the absolute path
|
||||||
|
|
||||||
|
// Check for read/write/execute permissions on the directory
|
||||||
|
// We only need to check the parent directory where the file will be created
|
||||||
|
QFileInfo dirInfo(destinationDir.absolutePath());
|
||||||
|
QString dirPath = dirInfo.absolutePath();
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Windows systems
|
||||||
|
DWORD fileAttributes = GetFileAttributes(dirPath.toStdString().c_str());
|
||||||
|
|
||||||
|
// Windows has no direct R/W/X permission model like Linux. We check for basic file existence.
|
||||||
|
bool canRead = !(fileAttributes & FILE_ATTRIBUTE_READONLY);
|
||||||
|
bool canWrite = true; // If not read-only, assume write is possible.
|
||||||
|
|
||||||
|
if !(canRead && canWrite)
|
||||||
|
{
|
||||||
|
PermissionError(absolutePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
// Linux/Unix systems
|
||||||
|
if (access(dirPath.toStdString().c_str(), R_OK | W_OK | X_OK) != 0)
|
||||||
|
{
|
||||||
|
PermissionError(absolutePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// If a match is found, revert back to the base name, add a number and the extension, and try again.
|
// 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.
|
// Keep incrementing the number until we get a unique result.
|
||||||
while (m_srcCardInfo.type == MemoryCardType::File ? FileSystem::DirectoryExists(Path::Combine(EmuFolders::MemoryCards, destName.toStdString()).c_str()) : FileSystem::FileExists(Path::Combine(EmuFolders::MemoryCards, destName.toStdString()).c_str()))
|
while (m_srcCardInfo.type == MemoryCardType::File ? FileSystem::DirectoryExists(Path::Combine(EmuFolders::MemoryCards, destName.toStdString()).c_str()) : FileSystem::FileExists(Path::Combine(EmuFolders::MemoryCards, destName.toStdString()).c_str()))
|
||||||
|
@ -303,3 +343,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."));
|
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::PermissionError(QString absolutePath)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Cannot Convert Memory Card"),tr("You have insufficient permissions to convert this Memory Card. Please ensure that your user owns the directory of your Memory Cards. \n \"%1\".").arg(absolutePath));
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ private:
|
||||||
void SetType_32();
|
void SetType_32();
|
||||||
void SetType_64();
|
void SetType_64();
|
||||||
void SetType_Folder();
|
void SetType_Folder();
|
||||||
|
void PermissionError(QString absolutePath);
|
||||||
|
|
||||||
Ui::MemoryCardConvertDialog m_ui;
|
Ui::MemoryCardConvertDialog m_ui;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue