diff options
Diffstat (limited to 'launcher/settings/INISettingsObject.cpp')
-rw-r--r-- | launcher/settings/INISettingsObject.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/launcher/settings/INISettingsObject.cpp b/launcher/settings/INISettingsObject.cpp index 12513403..da962ee9 100644 --- a/launcher/settings/INISettingsObject.cpp +++ b/launcher/settings/INISettingsObject.cpp @@ -16,7 +16,30 @@ #include "INISettingsObject.h" #include "Setting.h" -INISettingsObject::INISettingsObject(const QString &path, QObject *parent) +#include <QDebug> +#include <QFile> + +INISettingsObject::INISettingsObject(QStringList paths, QObject *parent) + : SettingsObject(parent) +{ + auto first_path = paths.constFirst(); + for (auto path : paths) { + if (!QFile::exists(path)) + continue; + + if (path != first_path && QFile::exists(path)) { + // Copy the fallback to the preferred path. + QFile::copy(path, first_path); + qDebug() << "Copied settings from" << path << "to" << first_path; + break; + } + } + + m_filePath = first_path; + m_ini.loadFile(first_path); +} + +INISettingsObject::INISettingsObject(QString path, QObject* parent) : SettingsObject(parent) { m_filePath = path; |