settings: treat an unversioned settings file as the current format

fixes #3956
port 2.0

(cherry picked from commit 5cd0b61402)
This commit is contained in:
bbedward authored and dux-ci[bot] committed 2026-10-27 13:46:45 +00:00
1 parent a10ee7d3ed
commit f9c73a77cf
2 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -1836,7 +1836,7 @@ Singleton {
let obj = _getSettingsObjectFromFiles();
let loadedSettings = JSON.stringify(obj);
const oldVersion = obj?.configVersion ?? 0;
const oldVersion = obj?.configVersion ?? settingsConfigVersion;
if (oldVersion > settingsConfigVersion) {
newerSettingsBackup.path = `${_configDir}/dms/settings.v${oldVersion}.json`;
newerSettingsBackup.setText(JSON.stringify(obj, null, 2));
+4 -1
View File
@@ -232,8 +232,11 @@ function migrateToVersion(obj, targetVersion) {
if (!obj)
return null;
// hand-written and nix-generated files carry no version and are authored against the current format
if (obj.configVersion === undefined)
return null;
var settings = JSON.parse(JSON.stringify(obj));
var currentVersion = settings.configVersion || 0;
var currentVersion = settings.configVersion;
if (currentVersion >= targetVersion) {
return null;