fix infinite loop in undoing renaming of /x/x to /x

pull/199/head
nightwing 2015-10-12 17:01:46 +04:00
rodzic f6fab2629a
commit fedde93fa5
1 zmienionych plików z 30 dodań i 25 usunięć

Wyświetl plik

@ -292,29 +292,33 @@ define(function(require, exports, module) {
// Validation // Validation
var toNode = findNode(newPath); var toNode = findNode(newPath);
if (parent) { // Dir is in cache deleteNode(node, true);
if (toNode) if (toNode)
deleteNode(toNode); deleteNode(toNode, true);
createNode(newPath, null, node); // Move node createNode(newPath, null, node); // Move node
recurPathUpdate(node, oldPath, newPath); recurPathUpdate(node, oldPath, newPath);
e.undo = function(){
if (!parent) {
var tmpParent = node;
while (node.parent && tmpParent.parent.status == "pending")
tmpParent = tmpParent.parent;
if (tmpParent)
deleteNode(tmpParent, true);
}
deleteNode(node, true);
if (toNode)
createNode(newPath, null, toNode);
e.undo = function(){ createNode(oldPath, null, node);
createNode(oldPath, null, node); recurPathUpdate(node, newPath, oldPath);
recurPathUpdate(node, newPath, oldPath); };
e.confirm = function() {
if (toNode) if (node.status === "predicted")
createNode(newPath, null, toNode); node.status = "loaded";
}; };
e.confirm = function() { node.status = "predicted";
if (node.status === "predicted")
node.status = "loaded";
};
node.status = "predicted";
}
else {
removeSingleNode(e);
}
}, plugin); }, plugin);
fs.on("afterRename", afterHandler, plugin); fs.on("afterRename", afterHandler, plugin);
@ -553,10 +557,6 @@ define(function(require, exports, module) {
node.status = "loaded"; node.status = "loaded";
} }
if (isFolder && !node.map)
node.map = {};
else if (!isFolder && node.map)
delete node.map;
if (stat.size != undefined) if (stat.size != undefined)
node.size = stat.size; node.size = stat.size;
if (stat.mtime != undefined) if (stat.mtime != undefined)
@ -566,6 +566,11 @@ define(function(require, exports, module) {
node.isFolder = isFolder; node.isFolder = isFolder;
} }
if (node.isFolder && !node.map)
node.map = {};
else if (!node.isFolder && node.map)
delete node.map;
node.children = null; node.children = null;
if (!updating) { if (!updating) {