Skip to content

Commit

Permalink
Revert for changes for preventing side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchuan committed Apr 16, 2019
1 parent 0b34107 commit a7c597a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions lib/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit a7c597a

Please sign in to comment.