From 50773448d90b621aebc309ec1daa3e1aa9d5af2b Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Sat, 13 Aug 2011 22:35:06 +0200 Subject: [PATCH] Small change in the way config files are found, now includes global config and error handling --- apps/launcher/maindialog.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index f51b3b5497..498f775cb6 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -273,14 +273,31 @@ void MainDialog::setupConfig() QFile file(config); if (!file.exists()) { - config = QString::fromStdString(Files::getPath(Files::Path_ConfigUser, - "openmw", "openmw.cfg")); + file.setFileName(QString::fromStdString(Files::getPath(Files::Path_ConfigUser, + "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("
Could not open %0

\ + Please make sure you have the right permissions and try again.
").arg(file.fileName())); + msgBox.exec(); + + file.close(); + QApplication::exit(); // No config file available } + // Open our config file + mGameConfig = new QSettings(file.fileName(), QSettings::IniFormat); file.close(); - - // Open our config file - mGameConfig = new QSettings(config, QSettings::IniFormat); } void MainDialog::writeConfig()