diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-12-19 11:29:30 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-12-19 11:43:15 -0600 |
| commit | 830b63c4e20ffe3fee1ebffc9b88c45305f6737d (patch) | |
| tree | d8b811cd7ceae41d4f0241efa096a7be74f50dae | |
| parent | 662772c2fc8ec598a64cc4cabe13a86f1e83fb2e (diff) | |
Re-initialize the profile configuration if INI files are missing
| -rw-r--r-- | src/profile.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/profile.cpp b/src/profile.cpp index 536dfd98..f1bec4dd 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -768,7 +768,25 @@ bool Profile::enableLocalSaves(bool enable) bool Profile::localSettingsEnabled() const { - return setting("LocalSettings", false).toBool(); + bool enabled = setting("LocalSettings", false).toBool(); + if (enabled) { + bool reinitConfig = false; + for (QString file : m_GamePlugin->iniFiles()) { + if (!QFile::exists(m_Directory.filePath(file))) { + qWarning("missing %s in %s", qPrintable(file), qPrintable(m_Directory.path())); + reinitConfig = true; + } + } + if (reinitConfig) { + QMessageBox::StandardButton res = QMessageBox::warning( + QApplication::activeModalWidget(), tr("Missing profile-specific game INI files!"), + tr("Some of your profile-specific game INI files were missing. They will now be copied " + "from the vanilla game folder. You might want double-check your settings.") + ); + m_GamePlugin->initializeProfile(m_Directory, IPluginGame::CONFIGURATION); + } + } + return enabled; } bool Profile::enableLocalSettings(bool enable) |
