forked from teamnwah/openmw-tes3coop
Fixed config file writing when file does not exist
This commit is contained in:
parent
3e6658428b
commit
c9be134226
1 changed files with 6 additions and 5 deletions
|
@ -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("<br><b>Could not open %0</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>Could not open or create %0</b><br><br> \
|
||||
Please make sure you have the right permissions and try again.<br>").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.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
|
||||
return;
|
||||
std::exit(1);;
|
||||
}
|
||||
|
||||
file.write(buffer);
|
||||
|
||||
QTextStream out(&file);
|
||||
|
||||
// Write the list of game files to the config
|
||||
|
|
Loading…
Reference in a new issue