convert old quicklaunch.json key names to the new ones.

pull/2645/head
thyttan 2023-03-12 01:39:28 +01:00
parent 4940bcb834
commit 1b85a2bfca
1 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,19 @@
var storage = require("Storage");
var settings = Object.assign(storage.readJSON("quicklaunch.json", true) || {});
// Convert settings object from before v.0.12
for (let c of ["leftapp","rightapp","upapp","downapp","tapapp"]){
if (settings[c]) {
if (settings[c].name=="Quick Launch Extension") settings[c].name = "Extension";
settings[c.substring(0,1)+"app"] = settings[c];
delete settings[c];
}
}
for (let c of ["extleftapp","extrightapp","extupapp","extdownapp","exttapapp"]){
if (settings[c]) delete settings[c];
}
// Add default settings if they haven't been configured before.
for (let c of ["lapp","rapp","uapp","dapp","tapp"]){ // l=left, r=right, u=up, d=down, t=tap.
if (!settings[c]) settings[c] = {"name":"(none)"};
}