Library

File System Watcher

Notifications {add, remove, rename, modified} for files and directories

Usable
Dependencies

No library-level dependencies

SaneCppFileSystemWatcher.h is a library that allows watching directories for changes that happen to them.

Dependencies

  • Dependencies: (none)
  • All dependencies: (none)

Dependency Graph

Features

  • Get notified about modified files or directories
  • Get notified about added / removed / renamed files or directories
  • Async backend support via FileSystemWatcherAsyncT template

Status

Usable Library does have basic capabilities and it can be used just fine.

Blog

Some relevant blog posts are:

Description

Videos

This is the list of videos that have been recorded showing some of the internal thoughts that have been going into this library:

Blog

Some relevant blog posts are:

Details

The class tries to unify differences between OS specific API to deliver folder change notifications

  • On macOS and iOS FSEvents by CoreServices is used.
  • On Windows ReadDirectoryChangesW is used.

The behavior between these different system also depends on the file system where the watched directory resides.

Note: On iOS FSEvents api is private so using SC::FileSystemWatcher will be very likely causing your app to be rejected from the app store.

Examples

  • SCExample uses SC::FileSystemWatcher for a simple hot-reload system
  • Tests inside FileSystemWatcherTest.cpp show how the API is meant to be used
  • Tests inside FileSystemWatcherAsyncTest.cpp show how the Async API is meant to be used

Roadmap

Complete Features:

  • Not sure what else could be useful here

💡 Unplanned Features:

  • Having a thread based polling stat watcher that checks file modifications on intervals as fallback
  • Allow users to provide their own thread instead of creating it behind the scenes

Statistics

Type Lines Of Code Comments Sum
Headers 219 144 363
Sources 1311 302 1613
Sum 1530 446 1976