update watchers when renaming files

pull/314/merge
nightwing 2016-06-14 01:06:46 +04:00
rodzic cf9329d728
commit 745511f8b5
2 zmienionych plików z 21 dodań i 5 usunięć

Wyświetl plik

@ -254,7 +254,7 @@ define(function(require, exports, module) {
};
e.confirm = function () {
if (node.status === "predicted")
node.status = "loaded";
node.status = "pending";
};
node.status = "predicted";
}
@ -348,7 +348,7 @@ define(function(require, exports, module) {
}
if (node.status === "predicted")
node.status = "loaded";
node.status = "pending";
};
node.status = "predicted";
}, plugin);
@ -382,7 +382,7 @@ define(function(require, exports, module) {
};
e.confirm = function() {
if (node.status === "predicted")
node.status = "loaded";
node.status = "pending";
};
node.status = "predicted";
}, plugin);

Wyświetl plik

@ -48,8 +48,23 @@ define(function(require, exports, module) {
fs.on("beforeWriteFile", ignoreHandler, plugin);
fs.on("afterWriteFile", doneHandler, plugin);
fs.on("beforeRename", ignoreHandler, plugin);
fs.on("afterRename", doneHandler, plugin);
fs.on("beforeRename", function(e) {
e.watchers = [];
Object.keys(handlers).forEach(function(path) {
if (path == e.path || path.startsWith(e.path + "/")) {
if (unwatch(path))
e.watchers.push(path.slice(e.path.length));
}
});
ignoreHandler(e);
}, plugin);
fs.on("afterRename", function(e) {
doneHandler(e);
var toPath = e.result[0] ? e.path : e.args[1];
e.watchers.forEach(function(path) {
watch(toPath + path);
});
}, plugin);
fs.on("beforeMkdir", ignoreHandler, plugin);
fs.on("afterMkdir", doneHandler, plugin);
fs.on("beforeMkdirP", ignoreHandler, plugin);
@ -224,6 +239,7 @@ define(function(require, exports, module) {
fs.unwatch(path, handlers[path]);
emit("unwatch", { path: path });
delete handlers[path];
return true;
} else {
handlers[path].unwatchScheduled = true;
}