-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I tried out watching a folder named "test" in Windows 10:
import core.thread: Thread, msecs;
import std.stdio;
import fswatch;
void main(string[] args) {
FileWatch watcher = FileWatch("test", true);
while(true) {
writeln(watcher.getEvents());
Thread.sleep(500.msecs);
}
}I noticed that I receive more messages than needed:
// Saving a file in notepad
[]
[FileChangeEvent(modify, "file.txt", "")]
[]
[FileChangeEvent(modify, "file.txt", "")]
[]
[]
// Saving a new file in notepad
[]
[FileChangeEvent(create, "newfile.txt", "")]
[]
[FileChangeEvent(remove, "newfile.txt", ""), FileChangeEvent(create, "newfile.txt", ""), FileChangeEvent(modify, "newfile.txt", ""), FileChangeEvent(modify, "newfile.txt", "")]
[]
// Creating a file using std.file.write
[]
[FileChangeEvent(create, "hey.txt", "")]
[]
[FileChangeEvent(modify, "hey.txt", "")]
[]
Even if I change the sleep time, it's always first an empty event array and then an array with redundant messages. I don't know if this is just how the Windows API works or if some extra modifications are being done under the hood, but it's weird how they show up only after calling getEvents() twice more.
SrMordred
Metadata
Metadata
Assignees
Labels
No labels