SpartanJ / efsw

efsw is a C++ cross-platform file system watcher and notifier.
Other
662 stars 101 forks source link

Recursive inotify watches should maintain the same root ID #139

Closed mktange closed 2 years ago

mktange commented 2 years ago

I assume it is intended that the WatchID passed to handleFileAction should match that originally returned by addWatch.

When using the inotify watcher recursively, it creates child inotify watches for each folder. The WatchID passed to handleFileAction will currently be that of the underlying child inotify watcher that triggers it, and not the ID originally returned by efsw's addWatch (which will be the root directory inotify watcher ID).

This will make the IDs of the child inotify watchers opaque to users of efsw by storing it in a separate member variable, and then maintaining the parent/root ID while creating child watchers.

SpartanJ commented 2 years ago

Thanks, I never use the WatchID and never saw the issue.