diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index afa80eafd2..c1f6d8b7e4 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -335,17 +335,17 @@ void MainDialog::writeConfig()
QFile file(QString::fromStdString(Files::getPath(Files::Path_ConfigUser,
"openmw", "openmw.cfg")));
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
// File cannot be opened or created
QMessageBox msgBox;
- msgBox.setWindowTitle("Error opening OpenMW configuration file");
+ msgBox.setWindowTitle("Error writing OpenMW configuration file");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
- msgBox.setText(tr("
Could not open %0
\
+ msgBox.setText(tr("
Could not open or create %0
\
Please make sure you have the right permissions and try again.
").arg(file.fileName()));
msgBox.exec();
- return;
+ std::exit(1);
}
QTextStream in(&file);
@@ -371,10 +371,11 @@ void MainDialog::writeConfig()
Please make sure you have the right permissions and try again.
").arg(file.fileName()));
msgBox.exec();
- return;
+ std::exit(1);;
}
file.write(buffer);
+
QTextStream out(&file);
// Write the list of game files to the config