Fix rename.
authorCamila <hello@camila.codes>
Mon, 23 Jan 2023 16:01:49 +0000 (16:01 +0000)
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 3b47300add987899d136e9438a81e56e6f68f5f9..a6a2c281b665784899826e571e2355e2b6094594 100644 (file)
@@ -159,8 +159,10 @@ bool Application::configVersionMigration()
         const auto fileName = file.fileName();
         backupFilesList.append(configFile.backup(fileName));
         if (file.baseName() != APPLICATION_CONFIG_NAME) {
-            if (!QFile::rename(fileName, configFile.configFile())) {
-                qCWarning(lcApplication) << "Failed to rename configuration file from" << file.baseName() << "to" << configFile.configFile();
+            const auto newConfig = configFile.configFile();
+            const auto oldConfig = file.filePath();
+            if (!QFile::rename(oldConfig, newConfig)) {
+                qCWarning(lcApplication) << "Failed to rename configuration file from" << oldConfig << "to" << newConfig;
             }
         }
     }