aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/qt_sdl/PathSettingsDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/qt_sdl/PathSettingsDialog.cpp')
-rw-r--r--src/frontend/qt_sdl/PathSettingsDialog.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/frontend/qt_sdl/PathSettingsDialog.cpp b/src/frontend/qt_sdl/PathSettingsDialog.cpp
index 1d69853..7134208 100644
--- a/src/frontend/qt_sdl/PathSettingsDialog.cpp
+++ b/src/frontend/qt_sdl/PathSettingsDialog.cpp
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <QFileDialog>
#include <QMessageBox>
+#include <QTemporaryFile>
#include "types.h"
#include "Config.h"
@@ -37,6 +38,7 @@ extern bool RunningSomething;
bool PathSettingsDialog::needsReset = false;
+constexpr char errordialog[] = "melonDS cannot write to that directory.";
PathSettingsDialog::PathSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::PathSettingsDialog)
{
@@ -101,6 +103,12 @@ void PathSettingsDialog::on_btnSaveFileBrowse_clicked()
QString::fromStdString(EmuDirectory));
if (dir.isEmpty()) return;
+
+ if (!QTemporaryFile(dir).open())
+ {
+ QMessageBox::critical(this, "melonDS", errordialog);
+ return;
+ }
ui->txtSaveFilePath->setText(dir);
}
@@ -112,6 +120,12 @@ void PathSettingsDialog::on_btnSavestateBrowse_clicked()
QString::fromStdString(EmuDirectory));
if (dir.isEmpty()) return;
+
+ if (!QTemporaryFile(dir).open())
+ {
+ QMessageBox::critical(this, "melonDS", errordialog);
+ return;
+ }
ui->txtSavestatePath->setText(dir);
}
@@ -123,6 +137,12 @@ void PathSettingsDialog::on_btnCheatFileBrowse_clicked()
QString::fromStdString(EmuDirectory));
if (dir.isEmpty()) return;
+
+ if (!QTemporaryFile(dir).open())
+ {
+ QMessageBox::critical(this, "melonDS", errordialog);
+ return;
+ }
ui->txtCheatFilePath->setText(dir);
}