AsyncDirectoryWatcher

Watches one or more directories in the local filesystem for the specified events by calling a custom event handler asynchroneously when they occur.

Usage: run() the object, start watching directories, receive an event in your handler, read the changes by draining the buffer.

Constructors

this
this(EventLoop evl)

Members

Functions

kill
bool kill()

Cleans up underlying resources.

readChanges
uint readChanges(ref DWChangeInfo[] dst)

Fills the buffer with file/folder events and returns the number of events consumed. Returns 0 when the buffer is drained.

run
bool run(void delegate() del)

Registers the object in the underlying event loop and sends notifications related to buffer activity by calling the specified handler.

unwatchDir
bool unwatchDir(string path, bool recursive)

Removes the directory and its files from the event watch list. Recursive will remove all subdirectories in the watch list.

watchDir
bool watchDir(string path, DWFileEvent ev = DWFileEvent.ALL, bool recursive = false)

Starts watching for file events in the specified directory, recursing into subdirectories will add those and its files to the watch list as well.

Properties

fd
fd_t fd [@property getter]

Meta