diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 44c8a30be2..c7ae2cc588 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -1,10 +1,13 @@ #include "maindialog.hpp" +#include +#include +#include #include +#include #include #include -#include #include #include #include @@ -288,33 +291,31 @@ bool Launcher::MainDialog::setupLauncherSettings() mLauncherSettings.setMultiValueEnabled(true); - QStringList paths; - paths.append(QString(Config::LauncherSettings::sLauncherConfigFileName)); - paths.append(Files::pathToQString(mCfgMgr.getUserConfigPath() / Config::LauncherSettings::sLauncherConfigFileName)); + const QString path + = Files::pathToQString(mCfgMgr.getUserConfigPath() / Config::LauncherSettings::sLauncherConfigFileName); - for (const QString& path : paths) + if (!QFile::exists(path)) + return true; + + Log(Debug::Verbose) << "Loading config file: " << path.toUtf8().constData(); + + QFile file(path); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug() << "Loading config file:" << path.toUtf8().constData(); - QFile file(path); - if (file.exists()) - { - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - { - cfgError(tr("Error opening OpenMW configuration file"), - tr("
Could not open %0 for reading

\ - Please make sure you have the right permissions \ - and try again.
") - .arg(file.fileName())); - return false; - } - QTextStream stream(&file); - Misc::ensureUtf8Encoding(stream); - - mLauncherSettings.readFile(stream); - } - file.close(); + cfgError(tr("Error opening OpenMW configuration file"), + tr("
Could not open %0 for reading:

%1

\ + Please make sure you have the right permissions \ + and try again.
") + .arg(file.fileName()) + .arg(file.errorString())); + return false; } + QTextStream stream(&file); + Misc::ensureUtf8Encoding(stream); + + mLauncherSettings.readFile(stream); + return true; } @@ -326,7 +327,6 @@ bool Launcher::MainDialog::setupGameSettings() auto loadFile = [&](const QString& path, bool (Config::GameSettings::*reader)(QTextStream&, bool), bool ignoreContent = false) -> std::optional { - qDebug() << "Loading config file:" << path.toUtf8().constData(); file.setFileName(path); if (file.exists()) {