Stops the watcher and releases all resources. Called automatically during shutdown.
Sets the callback invoked when filesystem changes are detected.
Called with an array of changed paths and a parallel array of per-path flag string arrays.
self, for chaining
Watches a filesystem path for changes and invokes a callback when they occur.
Created via
hs.fs.createPathWatcher(path). Set a callback withsetCallback(), then callstart()to begin receiving events.The callback receives
(paths, flags):paths: array of changed file/directory pathsflags: parallel array of string arrays, one per path, describing what changedPossible flag values in each per-path array:
"itemCreated""itemRemoved""itemRenamed""itemModified""itemInodeMetaMod""itemFinderInfoMod""itemChangeOwner""itemXattrMod""itemIsFile""itemIsDir""itemIsSymlink""itemIsHardlink""itemIsLastHardlink""itemCloned""ownEvent""mustScanSubDirs""userDropped""kernelDropped""rootChanged""mount""unmount""ownEvent"marks changes made by the Hammerspoon 2 process itself (e.g. viahs.fsorhs.spoons.install()), so a watcher can tell them apart from changes made by other apps. Changes made by child processes (such as a command run withhs.task) are not marked, because they come from a different process. FSEvents also combines changes to the same path that happen within about a second of each other, so if Hammerspoon and another process both change a path at around the same time, the combined event may or may not include"ownEvent". Treat it as a hint, not as proof of who changed a file.