| 20 | #include <QFile> |
| 21 | |
| 22 | INISettingsObject::INISettingsObject(QStringList paths, QObject* parent) : SettingsObject(parent) |
| 23 | { |
| 24 | auto first_path = paths.constFirst(); |
| 25 | for (auto path : paths) { |
| 26 | if (!QFile::exists(path)) |
| 27 | continue; |
| 28 | |
| 29 | if (path != first_path && QFile::exists(path)) { |
| 30 | // Copy the fallback to the preferred path. |
| 31 | QFile::copy(path, first_path); |
| 32 | qDebug() << "Copied settings from" << path << "to" << first_path; |
| 33 | break; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | m_filePath = first_path; |
| 38 | m_ini.loadFile(first_path); |
| 39 | } |
| 40 | |
| 41 | INISettingsObject::INISettingsObject(QString path, QObject* parent) : SettingsObject(parent) |
| 42 | { |