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";
}
// 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;
}
// Setup the localStorage when starting

View File

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