From a7c597aca025476fb862cae48b66ece348deca18 Mon Sep 17 00:00:00 2001 From: yuanchuan Date: Tue, 16 Apr 2019 21:45:47 +0800 Subject: [PATCH] Revert for changes for preventing side effects --- README.md | 4 ++++ lib/watch.js | 15 +-------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index a8827d6..a9ebe4c 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,10 @@ watcher.isClosed() ## Known issues +**Windows** + + * Will output its parent directory when a new file/directory is created in a deep directory. + **Windows, node < v4.2.5** * Failed to detect `remove` event diff --git a/lib/watch.js b/lib/watch.js index 275b5d2..5be51e2 100644 --- a/lib/watch.js +++ b/lib/watch.js @@ -58,26 +58,13 @@ function getMessages(cache) { var dup = hasDup(cache.map(function(c) { return c.replace(/^[~#]+|[~#]+$/, ''); })); + if (dup) { filtered = filtered.filter(function(m) { return is.exists(m) }); } - // Prevent redundant event for its parent when creating file/directory. - // The operation is kinda expensive so only be triggered under Windows. - // https://github.com/yuanchuan/node-watch/issues/79 - if (is.windows()) { - var parents = filtered.map(function(n) { - return path.parse(n).dir; - }); - filtered = filtered.filter(function(n) { - return !parents.some(function(m) { - return is.samePath(n, m); - }); - }); - } - return composeMessage(filtered) }