kopia lustrzana https://github.com/c9/core
update watchers when renaming files
rodzic
cf9329d728
commit
745511f8b5
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue