Filesystem watcher for changes
Watches for filesystem changes to act upon them.
There is not much to this library. Only a single function.
The watch function
This is the signature of the function:
(fs-watcher:watch pathnames callback &key (delay 1))
pathnamesis a pathname or a list of pathnames. Both are accepted.
callbackis a callback function called on each change.
:delayis the looping delay.
At first, the function will get the list of all pathnames. For example,
if you give a directory pathname,
fs-watcher will recursively look for
files and directories in it.
Once it has all the necessary information, it constantly polls for them to see if there is any change. This polling is done every second by default.
Whenever there is a change, the
callback is called with an argument:
the pathname that changed.
(fs-watcher:watch "/home/user/code/" #'(lambda (pathname) (inferior-shell:run/s "make")))