DirectoryWatcher
Win32 directory monitoring for folders inside the Yuari workspace.
Creates a watcher for a folder inside the Yuari workspace. recursive defaults to false.
local watcher = DirectoryWatcher.new("configs", true)
watcher:OnChanged(function(path)
print("changed", path)
end)
watcher:start()
Stops monitoring and releases the native directory handle.
watcher:stop()
Registers a callback invoked with the changed file path.
watcher:OnChanged(function(path) print(path) end)
Registers a callback invoked with the created file path.
watcher:OnCreated(function(path) print(path) end)
Registers a callback invoked with the deleted file path.
watcher:OnDeleted(function(path) print(path) end)
Registers a callback invoked with the renamed file path.
watcher:OnRenamed(function(path) print(path) end)
Registers a callback invoked when change events overflow.
watcher:OnOverflow(function() print("overflow") end)
Returns the workspace-relative path being watched.
print(watcher:GetPath())
Returns whether the watcher monitors subfolders.
print(watcher:IsRecursive())