Fixed file delete

This commit is contained in:
benweet 2013-04-22 02:36:20 +01:00
parent 450e1cf9ca
commit 694e30de9d
2 changed files with 17 additions and 2 deletions

View File

@ -556,6 +556,21 @@ define(
}); });
version = "v2"; version = "v2";
} }
// Upgrade from v2 to v3
if(version == "v2") {
var fileIndexList = _.compact(localStorage["file.list"].split(";"));
_.each(fileIndexList, function(fileIndex) {
if(!_.has(localStorage, fileIndex + ".sync")) {
localStorage.removeItem(fileIndex + ".title");
localStorage.removeItem(fileIndex + ".publish");
localStorage.removeItem(fileIndex + ".content");
localStorage["file.list"] = localStorage["file.list"].replace(";"
+ fileIndex + ";", ";");
}
});
version = "v3";
}
localStorage["version"] = version; localStorage["version"] = version;
} }
// Setup the localStorage when starting // Setup the localStorage when starting

View File

@ -89,17 +89,17 @@ define(["jquery", "core", "synchronizer", "publisher", "underscore"],
// Remove synchronized locations // Remove synchronized locations
var syncIndexList = _.compact(localStorage[fileIndex + ".sync"].split(";")); var syncIndexList = _.compact(localStorage[fileIndex + ".sync"].split(";"));
localStorage.removeItem(fileIndex + ".sync");
_.each(syncIndexList, function(syncIndex) { _.each(syncIndexList, function(syncIndex) {
fileManager.removeSync(syncIndex); fileManager.removeSync(syncIndex);
}); });
localStorage.removeItem(fileIndex + ".sync");
// Remove publish locations // Remove publish locations
var publishIndexList = _.compact(localStorage[fileIndex + ".publish"].split(";")); var publishIndexList = _.compact(localStorage[fileIndex + ".publish"].split(";"));
localStorage.removeItem(fileIndex + ".publish");
_.each(publishIndexList, function(publishIndex) { _.each(publishIndexList, function(publishIndex) {
fileManager.removePublish(publishIndex); fileManager.removePublish(publishIndex);
}); });
localStorage.removeItem(fileIndex + ".publish");
localStorage["file.list"] = localStorage["file.list"].replace(";" localStorage["file.list"] = localStorage["file.list"].replace(";"
+ fileIndex + ";", ";"); + fileIndex + ";", ";");