DirectoryWatcher relies on tracking state of the directories it is watching, which includes the names of files in the directory tree, whether they are directories, and (optionally) file hashes. Currently the initial state is computed in the constructor of DirectoryWatcher, but DirectoryWatcher does not begin updating the watcher state until watch()/watchAsync() is called. This creates a problem if your application creates a DirectoryWatcher instance without immediately using it.
The most reasonable behavior, I think, is to just initialize this state right before you start watching. I can't think of any reason not to do this.
DirectoryWatcher relies on tracking state of the directories it is watching, which includes the names of files in the directory tree, whether they are directories, and (optionally) file hashes. Currently the initial state is computed in the constructor of DirectoryWatcher, but DirectoryWatcher does not begin updating the watcher state until
watch()/watchAsync()
is called. This creates a problem if your application creates aDirectoryWatcher
instance without immediately using it.The most reasonable behavior, I think, is to just initialize this state right before you start watching. I can't think of any reason not to do this.