FileSystemWatcher Xojo Plugin

FileSystemWatcher.AddFolderWatch Method

Adds a folder to be watched.

AddFolderWatch(
   f as FolderItem,
   recursiveIfPossible as Boolean)

Parameters

f
The folder to be watched. See bellow more detail.
recursiveIfPossible
Set true if you want to try to get recursive watch else false. Linux systems cannot do recursive watches, so this parameter will do nothing on Linux. MacOS X systems cannot do non recursive watches so this parameter does nothing on OS X. Windows can do both recursive and non recursive watch, so windows systems will respect this parameter.

Remarks

FileSystemWatcher was supposed to fully abstract the platforms and be seamless across them. This however was not possible since the File system monitoring API’s across platforms were very different with very different limitations.
For example then Linux does not support recursive watches, MacOS X does not support non recursive watches, and Windows supports both. Those are the kind of limitations we have to work with.

So there will be slight differences across platforms, and there might be and almost certainly will be other differences than described here above. We recommend testing you application on all platforms and work around what the platforms can and cannot do.


All of the operating systems in some way warn against putting a watch high up on the root or watch directories where you will have huge number of activity. And that the watches will not always give accurate results and there will be times where you need to do full directory scan to be sure.


This method does nothing if:
  • Watching has been started.
  • The folder in the f parameter is nil or does not exist.
  • The folder in the f parameter is not directory.
  • The folder in the f parameter is not directory.
  • The FileSystemWatcher is already watching that specific folder. (The class is not smart enough to evaluated if the added folder is bellow existing folder in recursive watch, your logic will need to make sure that does not happen.

    See Also

    FileSystemWatcher Class