mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-19 12:39:42 +00:00
Load only launcher.cfg from user folder
There is no other launcher.cfg.
This commit is contained in:
parent
22c62a8c38
commit
b1d0ee1f1b
1 changed files with 25 additions and 25 deletions
|
@ -1,10 +1,13 @@
|
||||||
#include "maindialog.hpp"
|
#include "maindialog.hpp"
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
|
#include <components/files/conversion.hpp>
|
||||||
|
#include <components/files/qtconversion.hpp>
|
||||||
#include <components/misc/helpviewer.hpp>
|
#include <components/misc/helpviewer.hpp>
|
||||||
|
#include <components/misc/utf8qtextstream.hpp>
|
||||||
#include <components/version/version.hpp>
|
#include <components/version/version.hpp>
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QDebug>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
@ -288,33 +291,31 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
||||||
|
|
||||||
mLauncherSettings.setMultiValueEnabled(true);
|
mLauncherSettings.setMultiValueEnabled(true);
|
||||||
|
|
||||||
QStringList paths;
|
const QString path
|
||||||
paths.append(QString(Config::LauncherSettings::sLauncherConfigFileName));
|
= Files::pathToQString(mCfgMgr.getUserConfigPath() / Config::LauncherSettings::sLauncherConfigFileName);
|
||||||
paths.append(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();
|
cfgError(tr("Error opening OpenMW configuration file"),
|
||||||
QFile file(path);
|
tr("<br><b>Could not open %0 for reading:</b><br><br>%1<br><br> \
|
||||||
if (file.exists())
|
Please make sure you have the right permissions \
|
||||||
{
|
and try again.<br>")
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
.arg(file.fileName())
|
||||||
{
|
.arg(file.errorString()));
|
||||||
cfgError(tr("Error opening OpenMW configuration file"),
|
return false;
|
||||||
tr("<br><b>Could not open %0 for reading</b><br><br> \
|
|
||||||
Please make sure you have the right permissions \
|
|
||||||
and try again.<br>")
|
|
||||||
.arg(file.fileName()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
QTextStream stream(&file);
|
|
||||||
Misc::ensureUtf8Encoding(stream);
|
|
||||||
|
|
||||||
mLauncherSettings.readFile(stream);
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTextStream stream(&file);
|
||||||
|
Misc::ensureUtf8Encoding(stream);
|
||||||
|
|
||||||
|
mLauncherSettings.readFile(stream);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +327,6 @@ bool Launcher::MainDialog::setupGameSettings()
|
||||||
|
|
||||||
auto loadFile = [&](const QString& path, bool (Config::GameSettings::*reader)(QTextStream&, bool),
|
auto loadFile = [&](const QString& path, bool (Config::GameSettings::*reader)(QTextStream&, bool),
|
||||||
bool ignoreContent = false) -> std::optional<bool> {
|
bool ignoreContent = false) -> std::optional<bool> {
|
||||||
qDebug() << "Loading config file:" << path.toUtf8().constData();
|
|
||||||
file.setFileName(path);
|
file.setFileName(path);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue