gmethvin / directory-watcher

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

[JAVA] Multiple copy/delete operations do not emit 'CREATE' events afterwards #35

Closed mangum99 closed 5 years ago

mangum99 commented 5 years ago

Hi,

There is an issue on Windows10 (but probably it will be also reproducable in other operating systems). Steps to reproduce:

This probably has something to do with the "pathHashes"-variable, because when folder is being deleted only the hash of this folder gets deleted but its children remain in the "pathHashes". So if we copy again same files which are inside of some folder, events will be skipped.

If fileHashing is turned off then this use case works.

gmethvin commented 5 years ago

What version is this on?

I think we probably need to apply the same logic to deletion as we do for creation events. In other words, remove the hashes from the map for all files in the directory.

Any interest in submitting a pull request to fix it?

mangum99 commented 5 years ago

It was on the version 0.9.3. I'll take a look and try to provide some solution for it.