1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00

Small change in the way config files are found, now includes global config and error handling

This commit is contained in:
Pieter van der Kloet 2011-08-13 22:35:06 +02:00
parent 0a04008fc9
commit 50773448d9

View file

@ -273,14 +273,31 @@ void MainDialog::setupConfig()
QFile file(config); QFile file(config);
if (!file.exists()) { if (!file.exists()) {
config = QString::fromStdString(Files::getPath(Files::Path_ConfigUser, file.setFileName(QString::fromStdString(Files::getPath(Files::Path_ConfigUser,
"openmw", "openmw.cfg")); "openmw", "openmw.cfg")));
} }
if (!file.exists()) {
file.setFileName(QString::fromStdString(Files::getPath(Files::Path_ConfigGlobal,
"openmw", "openmw.cfg")));
}
if (!file.exists()) {
QMessageBox msgBox;
msgBox.setWindowTitle("Error opening OpenMW configuration file");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not open %0</b><br><br> \
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
msgBox.exec();
file.close(); file.close();
QApplication::exit(); // No config file available
}
// Open our config file // Open our config file
mGameConfig = new QSettings(config, QSettings::IniFormat); mGameConfig = new QSettings(file.fileName(), QSettings::IniFormat);
file.close();
} }
void MainDialog::writeConfig() void MainDialog::writeConfig()