I’m new to D Language and am looking for an efficient way to watch for a specific file to change.
Ultimately what I’d like is to have a watcher that waits for a file to change, and then executes a command based on the contents of the file (think of it as a plain-text queue list).
Code samples would be nice, but pointing me in the right direction would also be very helpful.
Also, this is going to run on a Linux environment.
Update
I’m going the route of using system utilities to monitor a file.
If you’re on Linux you can use
inotify, found in/usr/include/sys/inotify.h(on my system$PREFIXmight differ).The only thing you have to do is translating this header into a “D header”, or you use
DStepwhich might be able to translate the header for you.You might also want to use
fanotify, a newer replacement forinotify.Unfortunatly I don’t know how you can do that on Windows, all I found is a Windows-API function:
FindFirstChangeNotification