Create new INotify struct
D-ified inotify event, holds slice to temporary buffer with z-string.
Track events in the whole directory tree, automatically adding watches to any new sub-directories and stopping watches in the deleted ones.
Event as returned by INotifyTree. In constrast to Event, it has full path and no watch descriptor.
Type-safe watch descriptor to help discern it from normal file descriptors
import std.process, std.stdio : writeln, writefln; auto monitor = iNotify(); executeShell("rm -rf tmp"); executeShell("mkdir tmp"); // literals are zero-terminated monitor.add("tmp".ptr, IN_CREATE | IN_DELETE); ubyte[] data = [1, 2, 3, 4]; executeShell("touch tmp/killme"); auto events = monitor.read(); assert(events[0].mask == IN_CREATE); assert(events[0].name == "killme"); executeShell("rm -rf tmp/killme"); events = monitor.read(); assert(events[0].mask == IN_DELETE); // Note: watched directory doesn't track events in sub-directories executeShell("mkdir tmp/some-dir"); executeShell("touch tmp/some-dir/victim"); events = monitor.read(); assert(events.length == 1); assert(events[0].mask == (IN_ISDIR | IN_CREATE)); assert(events[0].name == "some-dir");
A tiny library to work with Linux's kernel inotify subsystem.