Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow watching directory non-recursively #54

Open
dneuschaefer-rube opened this issue Sep 16, 2020 · 1 comment
Open

Allow watching directory non-recursively #54

dneuschaefer-rube opened this issue Sep 16, 2020 · 1 comment

Comments

@dneuschaefer-rube
Copy link

dneuschaefer-rube commented Sep 16, 2020

I think it would be a nice addition to allow watching a directory non-recursively.

Currently, when registering a Path with the builder, the watcher is either set up with the FILE_TREE modifier or recursively for all descendant directories, depending on system capabilities. I circumvent this by instantiating the watcher with an empty path list, then initializing paths and pathHashes with a single path and hashes for all files, and then calling register(path, false), all using reflection. This does what I want, but needless to say, that's not great practice ;)

Thanks for the great library!

@gmethvin
Copy link
Owner

I think it would certainly be possible. The logic would be relatively simple except that I'm not quite sure how to configure non-recursive watching for macOS, so maybe we'll just have to filter events that are in a subdirectory.

I'm definitely open to adding the feature. Are you interested in attempting a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants