Closed helikopterodaktyl closed 5 years ago
works fine here under windows 10 VM
Interesting. Doesn't work with my Windows 10. I am using the 0.3.0 version of the library. Watching a file works, just the directory that doesn't.
having the folder there before starting and after starting doesn't make a difference. Have you tried exactly running your example code and not in the application?
Well... I restarted everything, IDE and all, rebuilt my app from scratch and it's working now. I have no idea why it didn't work before...
Ahhh. I see the issue. I don't know what is causing it, perhaps some threading related issue? If the FileWatch variable is a global, it doesn't work.
doesn't work:
FileWatch watcher;
void main() { watcher = FileWatch(... }
works:
void main() { FileWatch watcher = FileWatch(... }
Is this expected? I don't see why would one work, but not another.
hm there is some destruction code, does it work if you comment out line 106 (CloseHandle(pathHandle);
) for testing purposes?
void main() { FileWatch watcher; watcher = FileWatch(... }
declaring it like this also doesn't work. Works only if watcher is assigned during the declaration.
let me check
as workaround try FileWatch* watcher; watcher = new FileWatch(...);
Yes, the pointer works. Is this some obvious D thing that I am missing? I don't see what difference would it make.
have you tried commenting the code I told you to to see if it works without pointer then?
Yes, doesn't seem to have an effect :(
uh you have used the exact code you have initially posted + a declaration right? I don't really want to boot up my VM again...
If commenting that line doesn't change it I don't really know what could be causing it
Yes, exact code. Oh well, the pointer works for me, so I consider it non-issue.
with v0.5.0 that assignment issue should be fixed too
Code like this:
watcher = FileWatch("C:/test/", true); while (1) { foreach (event; watcher.getEvents()) { writeln(event.path); } }
when ran and creating/deleting/modifying files in C:\test\ directory, no paths get written to stdout