Handle database and profile upgrade for new versions.
This commit is contained in:
@@ -107,12 +107,15 @@ Tab{
|
||||
if (!name)
|
||||
throw "Profile doesn't have a name";
|
||||
|
||||
var version = profileObject.version !== undefined ? profileObject.version : 1;
|
||||
if (version !== appSettings.profileVersion)
|
||||
throw "This profile is not supported on this version of CRT.";
|
||||
|
||||
delete profileObject.name;
|
||||
|
||||
appSettings.appendCustomProfile(name, JSON.stringify(profileObject));
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
messageDialog.text = qsTr("There has been an error reading the file.")
|
||||
messageDialog.text = qsTr(err)
|
||||
messageDialog.open();
|
||||
}
|
||||
}
|
||||
@@ -144,6 +147,7 @@ Tab{
|
||||
var profileObject = appSettings.profilesList.get(currentIndex);
|
||||
var profileSettings = JSON.parse(profileObject.obj_string);
|
||||
profileSettings["name"] = profileObject.text;
|
||||
profileSettings["version"] = appSettings.profileVersion;
|
||||
|
||||
var result = fileIO.write(url, JSON.stringify(profileSettings, undefined, 2));
|
||||
if (!result)
|
||||
|
||||
Reference in New Issue
Block a user