class FolderMonitor

Inherits: IScriptExportable

Allows monitoring a file system folder for changes.

Depending on the flags set this monitor can notify you when file is changed/moved/renamed and similar.

Public

Constructors

FolderMonitor

FolderMonitor(const Path &folderPath, bool monitorSubdirectories, FolderChangeFlags changeFilter)

Starts monitoring a folder at the specified path.

folderPath
Absolute path to the folder you want to monitor.
monitorSubdirectories
If true, provided folder and all of its subdirectories will be monitored for changes. Otherwise only the provided folder will be monitored.
changeFilter
A set of flags you may OR together. Different notification events will trigger depending on which flags you set.

Methods

~FolderMonitor

~FolderMonitor() noexcept

Stops monitor the folder.

Update

void Update()

Triggers callbacks depending on events that ocurred.

Expected to be called once per frame.

Fields

OnModified

Event<void (const Path &)> OnModified

Triggers when a file in the monitored folder is modified.

Provides absolute path to the file.

OnAdded

Event<void (const Path &)> OnAdded

Triggers when a file/folder is added in the monitored folder.

Provides absolute path to the file/folder.

OnRemoved

Event<void (const Path &)> OnRemoved

Triggers when a file/folder is removed from the monitored folder.

Provides absolute path to the file/folder.

OnRenamed

Event<void (const Path &, const Path &)> OnRenamed

Triggers when a file/folder is renamed in the monitored folder.

Provides absolute path with old and new names.

Internal

Methods

GetPrivateDataInternal

Pimpl *GetPrivateDataInternal() const

Returns private data, for use by internal helper classes and methods.

Private

Methods

WorkerThreadMain

void WorkerThreadMain()

Worker method that monitors the IO ports for any modification notifications.

HandleNotifications

void HandleNotifications(FileNotifyInfo &notifyInfo)

Called by the worker thread whenever a modification notification is received.

Fields

m

Pimpl * m