Mac OS X
Components Crossplatform Mac & Win Server Client Old Guides Examples
New in version: 8.2 8.3 8.4 8.5 9.0 9.1 9.2 9.3 9.4 9.5 Statistic
Creates a new FSEvents monitor.
|Component||Version||macOS||Windows||Server||FileMaker Cloud||FileMaker iOS SDK|
|FSEvents||5.4||Yes||No||Yes, macOS only||No||No|
|PathList||List of folders to watch.
(or just one path)
The event ID from where to start. Can be the latest ID you saw last time or you pass "now" to start with now.
The flags. Can be a combination of NoDefer, WatchRoot, IgnoreSelf, FileEvents or MarkSelf.
Returns reference number or error.
DescriptionCreates a new FSEvents monitor.
Works on server and client.
May not work for network shared disks as most drivers don't pass through change events.
NoDefer = 2
Affects the meaning of the latency parameter. If you specify this flag and more than latency seconds have elapsed since the last event, your app will receive the event immediately. The delivery of the event resets the latency timer and any further events will be delivered after latency seconds have elapsed. This flag is useful for apps that are interactive and want to react immediately to changes but avoid getting swamped by notifications when changes are occurringin rapid succession. If you do not specify this flag, then when an event occurs after a period of no events, the latency timer is started. Any events that occur during the next latency seconds will be delivered as one group (including that first event). The delivery of the group of events resets the latency timer and any further events will be delivered after latency seconds. This is the default behavior and is more appropriate for background, daemon or batch processing apps.
WatchRoot = 4
Request notifications of changes along the path to the path(s) you're watching. For example, with this flag, if you watch "/foo/bar" and it is renamed to "/foo/bar.old", you would receive a RootChanged event. The same is true if the directory "/foo" were renamed. The event you receive is a special event: the path for the event is the original path you specified, the flag kFSEventStreamEventFlagRootChanged is set and event ID is zero. RootChanged events are useful to indicate that you should rescan a particular hierarchy because it changed completely (as opposed to the things inside of it changing). If you want to track the current location of a directory, it is best to open the directory before creating the stream so that you have a file descriptor for it and can issue an F_GETPATH fcntl() to find the current path.
IgnoreSelf = 8
Don't send events that were triggered by the current process. This is useful for reducing the volume of events that are sent. It is only useful if your process might modify the file system hierarchy beneath the path(s) being monitored. Note: this has no effect on historical events, i.e., those delivered before the HistoryDone sentinel event. Also, this does not apply to RootChanged events because the WatchRoot feature uses a separate mechanism that is unable to provide information about the responsible process.
FileEvents = 16
Request file-level notifications. Your stream will receive events about individual files in the hierarchy you're watching instead of only receiving directory level notifications. Use this flag with care as it will generate significantly more events than without it.
MarkSel = 32
Tag events that were triggered by the current process with the "OwnEvent" flag. This is only useful if your process might modify the file system hierarchy beneath the path(s) being monitored and you wish to know which events were triggered by your process. Note: this has no effect on historical events, i.e., those delivered before the HistoryDone sentinel event.
This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Created 18th November 2015, last changed 27th February 2019
Feedback: Report problem or ask question.
MBS Xojo Plugins