gmethvin / directory-watcher

A cross-platform Java recursive directory watcher, with a JNA macOS watcher and Scala better-files integration
Apache License 2.0
264 stars 34 forks source link

Ensure consistent behavior when a root watched directory is deleted #59

Open gmethvin opened 3 years ago

gmethvin commented 3 years ago

Currently, our macOS watch service fires an ENTRY_DELETE event on deletion of the root. The default JDK watchers don't appear to do this.

One solution for consistency is to simply update the implementation to not fire an event for the root.

It might make sense for DirectoryWatcher to fire a special type of event like ROOT_DELETED in this case. An application might want to handle that case specially because the watcher stops watching that directory completely once it's been deleted.