howeyc/fsnotify

OSX: Failure when watching a directory and a subdirectory

Closed this issue · 0 comments

Let's say we have two directories, A and B. Directory B is within directory A.

  1. Watching directory A places a DELETE watch on directory B
  2. Subsequently watching directory B (all events) does not invoke watchDirectoryFiles.
  3. Therefore, changes within directory B are not reported.

The suggested fix is to call watchDirectoryFiles even if found = true. (Pull request forthcoming)

Additionally, a different but related bug:

  1. Watch directory B
  2. Watch directory A, which downgrades the filter on directory B to DELETE, from all events.

The suggested fix here is to check if the directory is already watched. If so, either avoid calling addWatch for it if its flag includes DELETE, or always call addWatch with DELETE|current_flags. If it is not already watched, do the current thing.

The second fix is a little more involved, and I wasn't sure how to do it immediately..