filewatch/new
core-api
cfunction
src/core/filewatch.c on line 837, column 1
(filewatch/new chan & default-flags)
Create a new filewatcher that will give events to a channel `chan`.
See `filewatch/add` for available flags.
When an event is triggered by the filewatcher, a struct containing
information will be given to `chan` as with `ev/give`. The contents
of `chan` depend on the OS, but will contain some common keys:
* `:type` - type of the event that was raised
* `:file-name` - base file name of file that triggered the event
* `:dir-name` - directory name of file that triggered the event
Events will also contain keys specific to the host OS.
Windows has no extra properties on events.
Linux and BSDs have the following extra properties on events:
* `:wd` - integer key returned by `filewatch/add` for path that
triggered this. This is a file descriptor integer on BSD and
macos.
* `:wd-path` - string path for watched directory of file. For
files, same as `:file-name`, and for directories, same as
`:dir-name`.
* `:cookie` - a semi-randomized integer used to associate related
events, such as `:moved-from` and `:moved-to`.