-
-
Notifications
You must be signed in to change notification settings - Fork 949
Description
@jbowtie requested this feature at howeyc/fsnotify#56.
Windows and FSEvents (OS X) can watch a directory tree, in fact FSEvents is built entirely for this purpose:
if you monitor a directory with FSEvents then the monitor is recursive; there is no non-recursive option - @samjacobson howeyc/fsnotify#54 (comment)
Ideally fsnotify would expose a way to use this functionality on Windows and Macs.
Unfortunately inotify (Linux, Android), kqueue (BSD, iOS), and FEN (Solaris) don't have this capability.
There is some debate as to whether or not fsnotify should include a user-space recursive watcher to make up the difference. If not, perhaps it can be implemented a separate wrapper or utility library. In any case, it's something often requested, so we should definitely be thinking about it.
Implementation
In two parts:
- Walk subdirectories to Add (or Remove) watches for each directory:
- To avoid watching too much, it may be important to (optionally?) skip hidden directories (.git, .hg).
- My proposal to configure Ops filtering globally at the Watcher level (Built-in event filtering of Ops #7) simplifies recursive watching.
- Listen for incoming Create events to watch additional directories as they are created (again, avoiding hidden directories).