path for file changes and returns the watcher. The folder must
already exist inside your workspace.
Parameters
string
required
A workspace-relative folder. Use
"" to watch the workspace root. Leading
slashes are trimmed and backslashes are accepted, so "\\dev/sub\\" and
"dev/sub" are the same folder.boolean
default:"true"
Whether to watch subfolders too. Omit it, or pass
nil, for true.Returns
DirectoryWatcher
The watcher.
typeof reports "DirectoryWatcher".Behavior
- Cheap to create. Athena watches the workspace root once and filters per watcher, so a watcher opens no file handle and starts no thread of its own. Several watchers on overlapping folders cost no more than one.
Recursivecan be changed later and takes effect on the next change.- Events are created on first use, so an event you never touch costs nothing,
and
watcher.OnChanged == watcher.OnChangedholds.
Example
Errors
Related
Destroy: stop watching.- Filesystem: the workspace functions these paths work with.