Gio.File.prototype.monitor_directory

function monitor_directory(flags: Gio.FileMonitorFlags, cancellable: Gio.Cancellable): Gio.FileMonitor {
    // Gjs wrapper for g_file_monitor_directory()
}
  

Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.

If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.cancelled will be returned.

It does not make sense for flags to contain Gio.FileMonitorFlags.watch_hard_links, since hard links can not be made to directories. It is not possible to monitor all the files in a directory for changes made via hard links; if you want to do this then you must register individual watches with Gio.File.prototype.monitor.

flags

a set of Gio.FileMonitorFlags

cancellable

optional Gio.Cancellable object, null to ignore

Returns

a Gio.FileMonitor for the given file, or null on error. Free the returned object with GObject.Object.prototype.unref.