Something like this:


module file_watcher;

import std.concurrency;
import std.file;
import std.signals;
import std.datetime;


void fileWatcher(Tid tid, string filename, int loopSleep) {
        auto modified0 = timeLastModified(filename);

        while (true) {
                modified = timeLastModified(filename);
                        
                if (modified > modified0) {
                        modified0 = modified;
                        //if (onFileChange !is null)
                        //    onFileChange(receiver);
                }

                sleep(dur!"msecs"(loopSleep));
        }
}


But I'm not sure how to send the onFiledChange event.


Reply via email to