mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
Check for write permissions for some key files (#1972)
* check if an nds save file can be opened for writing also add the ability to open a file in append mode * fix multi-instance saves also move the check for file writability into a separate function (probably uneeded?) * implement check for gba roms * move rom load error messages into the functions also finish gba slot (oops) * improve error string * check write perms before saving path settings * fix memory leak * check for writability of firmware/nand/sds * add secondary checks for nand/firmware * add check for config file being writable * Return the file write error as a QString to avoid the invalid char* causing a garbled error message. Qt wants it as QString either way.
This commit is contained in:
@ -380,6 +380,12 @@ void EmuSettingsDialog::on_btnFirmwareBrowse_clicked()
|
||||
|
||||
if (file.isEmpty()) return;
|
||||
|
||||
if (!Platform::CheckFileWritable(file.toStdString()))
|
||||
{
|
||||
QMessageBox::critical(this, "melonDS", "Unable to write to firmware file.\nPlease check file/folder write permissions.");
|
||||
return;
|
||||
}
|
||||
|
||||
updateLastBIOSFolder(file);
|
||||
|
||||
ui->txtFirmwarePath->setText(file);
|
||||
@ -436,6 +442,12 @@ void EmuSettingsDialog::on_btnDLDISDBrowse_clicked()
|
||||
|
||||
if (file.isEmpty()) return;
|
||||
|
||||
if (!Platform::CheckFileWritable(file.toStdString()))
|
||||
{
|
||||
QMessageBox::critical(this, "melonDS", "Unable to write to DLDI SD image.\nPlease check file/folder write permissions.");
|
||||
return;
|
||||
}
|
||||
|
||||
updateLastBIOSFolder(file);
|
||||
|
||||
ui->txtDLDISDPath->setText(file);
|
||||
@ -468,6 +480,13 @@ void EmuSettingsDialog::on_btnDSiFirmwareBrowse_clicked()
|
||||
|
||||
if (file.isEmpty()) return;
|
||||
|
||||
if (!Platform::CheckFileWritable(file.toStdString()))
|
||||
{
|
||||
QMessageBox::critical(this, "melonDS", "Unable to write to DSi firmware file.\nPlease check file/folder write permissions.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
updateLastBIOSFolder(file);
|
||||
|
||||
ui->txtDSiFirmwarePath->setText(file);
|
||||
@ -482,6 +501,13 @@ void EmuSettingsDialog::on_btnDSiNANDBrowse_clicked()
|
||||
|
||||
if (file.isEmpty()) return;
|
||||
|
||||
if (!Platform::CheckFileWritable(file.toStdString()))
|
||||
{
|
||||
QMessageBox::critical(this, "melonDS", "Unable to write to DSi NAND image.\nPlease check file/folder write permissions.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
updateLastBIOSFolder(file);
|
||||
|
||||
ui->txtDSiNANDPath->setText(file);
|
||||
@ -510,6 +536,12 @@ void EmuSettingsDialog::on_btnDSiSDBrowse_clicked()
|
||||
|
||||
if (file.isEmpty()) return;
|
||||
|
||||
if (!Platform::CheckFileWritable(file.toStdString()))
|
||||
{
|
||||
QMessageBox::critical(this, "melonDS", "Unable to write to DSi SD image.\nPlease check file/folder write permissions.");
|
||||
return;
|
||||
}
|
||||
|
||||
updateLastBIOSFolder(file);
|
||||
|
||||
ui->txtDSiSDPath->setText(file);
|
||||
|
Reference in New Issue
Block a user