Replacing a file only creates a delete event not a create event
I'm using java.nio.file.Files.move(file1, file2, REPLACE_EXISTING) to replace a file from the watched folder then I only get a DELETED change not a CREATED. I would expect both events to trigger.
Interesting. I wonder if that's a bug in this project or the JDK? The former seems more likely.
Do you want to raise a Draft PR with a (failing) test that illustrates this?
FTR @edewit said that when using com.google.common.io.Files.move(File, File) this problem does not happen. We suspect it's some sort of timing issue. (Once I've figured a solution, perhaps the new test case could cover both.)
We suspect it's some sort of timing issue.
Perhaps this is related to the ch.vorburger.fswatch.QuietPeriodListener.
Just tested this and your right it's just a configuration problem with .quietPeriodInMS(0) it works perfectly
Let's keep this open? I'm glad it's related to that, and there's a "workaround" (?), but perhaps I could make the quiet filter better aware of different event types, for it to be more "correct".
I (briefly, mobile, while commuting) looked at src, and that quiet listener doesn't actually seem right to me (in hindsight, I originally wrote it)... I'll see if I can rewrite it, some other evening.
In the meantime, the workaround above (which avoids it from being used) seems like a good solution.