fix wrong detectiion of current config file as a config migration
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 31 Jan 2023 17:41:43 +0000 (18:41 +0100)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Thu, 2 Feb 2023 07:44:48 +0000 (08:44 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/application.cpp

index b20a60117301eaea8d9c690143b4b66dcb969664..d8e7291d8eb6d22e1d4a4b116e44588e8ab5b775 100644 (file)
@@ -157,11 +157,12 @@ bool Application::configVersionMigration()
     const auto anyConfigFileNameList = configDir.entryInfoList({"*.cfg"}, QDir::Files);
     for (const auto &oldConfig : anyConfigFileNameList) {
         const auto oldConfigFileName = oldConfig.fileName();
+        const auto oldConfigFilePath = oldConfig.filePath();
         const auto newConfigFileName = configFile.configFile();
         backupFilesList.append(configFile.backup(oldConfigFileName));
-        if (oldConfigFileName != newConfigFileName) {
-            if (!QFile::rename(oldConfig.filePath(), newConfigFileName)) {
-                qCWarning(lcApplication) << "Failed to rename configuration file from" << oldConfigFileName << "to" << newConfigFileName;
+        if (oldConfigFilePath != newConfigFileName) {
+            if (!QFile::rename(oldConfigFilePath, newConfigFileName)) {
+                qCWarning(lcApplication) << "Failed to rename configuration file from" << oldConfigFilePath << "to" << newConfigFileName;
             }
         }
     }