close editor after rename or remove the file

This commit is contained in:
Liang Ding 2015-10-03 15:00:19 +08:00
parent 6fe83917dd
commit 15f3c12579
2 changed files with 9 additions and 4 deletions

View File

@ -495,14 +495,14 @@ func (sessions *wSessions) new(httpSession *sessions.Session, sid string) *WideS
logger.Trace(event) logger.Trace(event)
if event.Op&fsnotify.Create == fsnotify.Create { if event.Op&fsnotify.Create == fsnotify.Create {
if err = watcher.Add(path); nil != err {
logger.Warn(err, path)
}
fileType := "f" fileType := "f"
if util.File.IsDir(path) { if util.File.IsDir(path) {
fileType = "d" fileType = "d"
if err = watcher.Add(path); nil != err {
logger.Warn(err, path)
}
} }
cmd := map[string]interface{}{"path": path, "dir": dir, cmd := map[string]interface{}{"path": path, "dir": dir,

View File

@ -199,6 +199,11 @@ var session = {
var node = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.path)); var node = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.path));
tree.fileTree.removeNode(node); tree.fileTree.removeNode(node);
var nodes = tree.fileTree.transformToArray(node);
for (var i = 0, ii = nodes.length; i < ii; i++) {
editors.tabs.del(nodes[i].path);
}
break; break;
} }
}; };