gmethvin / directory-watcher

A cross-platform Java recursive directory watcher, with a JNA macOS watcher and Scala better-files integration
Apache License 2.0
264 stars 34 forks source link

Fixes #81 #82

Closed zenios closed 2 years ago

zenios commented 2 years ago

I decided its better to expose the whole file visiting functionality to the consumer providing a default implementation that uses Files.walkFileTree and continues on visitFileFailed. You can override using a new visitor or keep using the default passing an error handler.

The default files visitor error handler does not allow you to override the default response (CONTINUE) since we require consistent behaviour.

Looking forwards to your comments

zenios commented 2 years ago

Hi i did the changes requested. Please check

zenios commented 2 years ago

Hi

createHashCodeMap and initWatcherState now behave the same. i.e Hashing done inside the callback

zenios commented 2 years ago

Hi Throwing an IOException from visitFile callback will not cause visitFileFailed to be called. visitFileFailed in only called if file attributes could not be read prior to calling visitFile. In order to enforce this in my tests i had to create a directory and setExecutable(false, false) to it, which i am not sure if it works on Windows. I am testing it on linux and everything seems fine.

Check it out and let me know

zenios commented 2 years ago

It seems that setExecutable does not work on WIndows. Disabled the test

gmethvin commented 2 years ago

released in v0.16.0