From 830b63c4e20ffe3fee1ebffc9b88c45305f6737d Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Wed, 19 Dec 2018 11:29:30 -0600 Subject: Re-initialize the profile configuration if INI files are missing --- src/profile.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/profile.cpp') 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) -- cgit v1.3.1