Merge pull request #82 from flowln/i_broke_something_again

This commit is contained in:
Sefa Eyeoglu 2022-10-18 22:15:08 +02:00 committed by GitHub
commit 2ebaf46095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,14 +23,16 @@ INISettingsObject::INISettingsObject(QStringList paths, QObject *parent)
: SettingsObject(parent)
{
auto first_path = paths.constFirst();
auto path = paths.takeFirst();
while (!QFile::exists(path))
path = paths.takeFirst();
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;
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;