diff --git a/lib/constants.js b/lib/constants.js index 1454f85b..4743865d 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -24,6 +24,7 @@ exports.FSEVENT_DELETED = 'deleted'; exports.FSEVENT_MOVED = 'moved'; exports.FSEVENT_CLONED = 'cloned'; exports.FSEVENT_UNKNOWN = 'unknown'; +exports.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1; exports.FSEVENT_TYPE_FILE = 'file'; exports.FSEVENT_TYPE_DIRECTORY = 'directory'; exports.FSEVENT_TYPE_SYMLINK = 'symlink'; diff --git a/lib/fsevents-handler.js b/lib/fsevents-handler.js index 0f7f2cba..fe29393c 100644 --- a/lib/fsevents-handler.js +++ b/lib/fsevents-handler.js @@ -37,6 +37,7 @@ const { FSEVENT_MOVED, // FSEVENT_CLONED, FSEVENT_UNKNOWN, + FSEVENT_FLAG_MUST_SCAN_SUBDIRS, FSEVENT_TYPE_FILE, FSEVENT_TYPE_DIRECTORY, FSEVENT_TYPE_SYMLINK, @@ -148,6 +149,7 @@ function setFSEventsListener(path, realPath, listener, rawEmitter) { rawEmitter, watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { if (!cont.listeners.size) return; + if (flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return; const info = fsevents.getInfo(fullPath, flags); cont.listeners.forEach(list => { list(fullPath, flags, info);