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

Add an option to follow symlinks #30

Open
gmethvin opened this issue Nov 30, 2018 · 4 comments
Open

Add an option to follow symlinks #30

gmethvin opened this issue Nov 30, 2018 · 4 comments

Comments

@gmethvin
Copy link
Owner

There should be an option in directory-watcher to follow symlinks and make sure they are handled properly with different configurations.

@ngocdaothanh
Copy link

Hi, does the lib support symlink? The README doesn't clarify if symlink is supported or not.

I've just tried on macOS 13.2.1, and it seems modification event is not emitted when the actual file of the symlink is modified (the symlink itself is not modified).

@gmethvin
Copy link
Owner Author

This issue is still accurate. There is currently no support for following symlinks.

I haven't spent much time looking into it, but if you're interested you're welcome to share your ideas here or submit a PR.

@CrysK
Copy link

CrysK commented Oct 3, 2024

Is there still no progress here?
Unfortunately, symlinks are still not working.

@gmethvin
Copy link
Owner Author

gmethvin commented Oct 3, 2024

@CrysK I don't have any plan to work on this in the near future. This is a personal project that I work on in my free time, and I don't have a particular need to handle symlinks in projects where I've used this library. As I said above I'm open to contributions from the community.

This also isn't completely trivial. There are questions the solution needs to consider, for example:

  1. For files within symlinked directories, do we return the path relative to the symlink or the destination file, or both? I believe there are also assumptions in the code that the watched root is always a prefix of the current file’s path, so some aspects of the implementation may need to change.
  2. When a symlink goes to a different filesystem, do we need to configure the watcher differently, and how would we provide an API for that? One example I can think of is using the last modified time in APFS for detecting changes. If your symlink goes to a filesystem with only second-level precision for modified times, then you might actually want to hash the file.
  3. How do you handle cycles in the directory structure when following the symlinks?

This isn’t something that’s supported natively by the JVM WatchService, so it would have to be done with logic entirely within the library code, probably by creating new watchers for the symlinks.

If people are interested in contributing I’m happy to discuss. We could maybe implement some partial solution but without understanding people's use cases it's hard to decide which parts to implement.

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

3 participants