Look for a previous config file with a different name.
authorCamila <hello@camila.codes>
Tue, 27 Dec 2022 17:25:23 +0000 (18:25 +0100)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Mon, 30 Jan 2023 08:44:17 +0000 (09:44 +0100)
Signed-off-by: Camila <hello@camila.codes>
src/gui/application.cpp

index 2aa726ffa2638993035945245e2d5fb4f010ecdb..d6c6db292a7da8319717bbe65eeb88d2ff203a84 100644 (file)
@@ -143,6 +143,17 @@ bool Application::configVersionMigration()
     // (The client version is adjusted further down)
     bool versionChanged = configFile.clientVersionString() != MIRALL_VERSION_STRING;
 
+    if (versionChanged) {
+        QDir directory(configFile.configPath());
+        const auto anyConfigFileList = directory.entryInfoList({"*.cfg"}, QDir::Files);
+        for (const auto &file : anyConfigFileList) {
+            if (file.baseName() != APPLICATION_CONFIG_NAME) {
+                QFile::rename(file.canonicalFilePath(), configFile.configFile());
+                break;
+            }
+        }
+    }
+
     // We want to message the user either for destructive changes,
     // or if we're ignoring something and the client version changed.
     bool warningMessage = !deleteKeys.isEmpty() || (!ignoreKeys.isEmpty() && versionChanged);