fswAddPath()

The functions add a path for monitoring to the FileSystemWatcher.

Synopsis

int fswAddPath(string path);

Parameters

Parameter Description
path Path to be monitored

Return value

Returns 0 if the path was successfully added for monitoring and .1 in case of an error.

Error

Possible errors are:

  • Path/file does not exist
  • Maximum amount of files that can be monitored was reached (OS dependent)

Description

The function adds a new path for monitoring to the FileSystemWatcher. The path is not added if it does not exist or is already part of the monitored paths.

Depending on the operating system the maximum number of simultaneously monitored paths can be limited. If a limit is reached no new paths can be added and the function returns an error.

It must be noted that the limit of the maximum number of files is also reduced by file handles opened in the background by the running process.

To react to changes to the registered paths the function sysConnect() provides the "fswPathChanged" event.

Example

main()
{
 fswAddPath("/tmp");
 fswAddPath("/someDir/someFile");
 sysConnect("pathChanged", "fswPathChanged");
}
pathChanged(string eventName, string path)
{
 DebugN(__FUNCTION__, path);
}

Assignment

Miscellaneous functions

Availability

UI, CTRL