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