Look for a previous config file with a different name.

Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
Camila 2022-12-27 18:25:23 +01:00 committed by Matthieu Gallien
parent bf258542cd
commit dbce267feb

View 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);