diff --git a/plugins/c9.fs/fs.cache.xml.js b/plugins/c9.fs/fs.cache.xml.js index c9ad1844..9d2a6c6d 100644 --- a/plugins/c9.fs/fs.cache.xml.js +++ b/plugins/c9.fs/fs.cache.xml.js @@ -56,20 +56,20 @@ define(function(require, exports, module) { removeSingleNode(e); }); - watcher.on("change", function(e) { - onstat({path: e.path, result: [null, e.stat]}); + watcher.on("change.all", function(e) { + onstat({ path: e.path, result: [null, e.stat] }); }); - watcher.on("directory", function(e) { + watcher.on("directory.all", function(e) { // @todo make onreaddir incremental - onreaddir({path: e.path, result: [null, e.files]}); + onreaddir({ path: e.path, result: [null, e.files] }); }); // Read fs.on("beforeReaddir", function (e) { var node = findNode(e.path); if (!node) - return; //Parent is not visible + return; // Parent is not visible // Indicate this directory is being read model.setAttribute(node, "status", "loading"); @@ -147,6 +147,8 @@ define(function(require, exports, module) { fs.on("afterReaddir", onreaddir, plugin); function onstat(e) { + var stat; + if (!e.error) { // update cache var there = true; @@ -168,14 +170,14 @@ define(function(require, exports, module) { deleteNode(node); } else { - var stat = e.result[1]; + stat = e.result[1]; if (typeof stat != "object") stat = null; createNode(e.path, stat); } } else if (there) { - var stat = e.result[1]; + stat = e.result[1]; if (typeof stat != "object") stat = null; createNode(e.path, stat, node); @@ -202,18 +204,19 @@ define(function(require, exports, module) { function addSingleNode(e, isFolder, linkInfo) { var node = findNode(e.path); - if (node) return; //Node already exists + if (node) return; // Node already exists if (!showHidden && isFileHidden(e.path)) return; var parent = findNode(dirname(e.path)); - if (parent) { //Dir is in cache + if (parent) { // Dir is in cache var stat = isFolder - ? {mime : "folder"} + ? { mime : "folder" } : (linkInfo - ? {link: true, linkStat: {fullPath: linkInfo}} - : null); + ? { link: true, linkStat: { fullPath: linkInfo } } + : {}); + stat.mtime = Math.floor(Date.now() / 1000); node = createNode(e.path, stat); emit("add", {path : e.path, node : node}); @@ -563,7 +566,10 @@ define(function(require, exports, module) { node.mtime = stat.mtime; if (original_stat || stat.linkErr) node.link = stat.fullPath || stat.linkErr; - node.isFolder = isFolder; + if (isFolder) + node.isFolder = isFolder; + else + delete node.isFolder; } if (node.isFolder && !node.map) @@ -736,6 +742,10 @@ define(function(require, exports, module) { }); plugin.on("unload", function(){ loaded = false; + showHidden = false; + hiddenFilePattern = ""; + hiddenFileRe = /^$/; + orphans = {}; }); /***** Register and define API *****/ diff --git a/plugins/c9.ide.watcher/watcher.js b/plugins/c9.ide.watcher/watcher.js index 3e754f4b..471cc838 100644 --- a/plugins/c9.ide.watcher/watcher.js +++ b/plugins/c9.ide.watcher/watcher.js @@ -188,6 +188,7 @@ define(function(require, exports, module) { function fireWatcherEvent(eventSuffix) { if (event == "error") { + if (eventSuffix != ".all") return; // console.error("[watchers] received error for", path, err, stat); } else if (event == "delete") {