Class CFileSystemWatcher

Nested Relationships

Nested Types

Class Documentation

class CFileSystemWatcher

This class subscribes to notifications of file system changes, thus it can be used to efficiently stay informed about changes in a directory tree.

  • Windows: Requires Windows 2000 or newer.

  • Linux: Requires kernel 2.6.13 or newer. Using this class in an old Linux or other unsoported system (Unix,etc…) has no effect, i.e. no notification will be ever received.

Public Types

using TFileSystemChangeList = std::deque<TFileSystemChange>

Public Functions

CFileSystemWatcher(const std::string &path)

Creates the subscription to a specified path.

Parameters:

path – The file or directory to watch.

virtual ~CFileSystemWatcher()

Destructor

void getChanges(TFileSystemChangeList &out_list)

Call this method sometimes to get the list of changes in the watched directory.

See also

processChange

struct TFileSystemChange

Each of the changes detected by mrpt::system::CFileSystemWatcher

Public Functions

TFileSystemChange() = default

Public Members

std::string path = {}

Complete path of the file/directory that has changed.

bool isDir = {false}

Whether the event happened to a file or a directory.

bool eventModified = {false}
bool eventCloseWrite = {false}
bool eventDeleted = {false}
bool eventMovedTo = {false}
bool eventMovedFrom = {false}
bool eventCreated = {false}
bool eventAccessed = {false}