Module file_watcher

Module file_watcher 

Source
Expand description

Filesystem watcher for auto-scanning new/changed audio files, DAW projects, presets, plugins, PDFs, and MIDI.

Uses the notify crate (FSEvents on macOS, inotify on Linux, ReadDirectoryChangesW on Windows) to watch configured scan directories. On create/modify, classifies paths by extension, maps each path to a scan root (parent dir for files; bundle dirs as-is), debounces 2s, collapses nested roots, then emits file-watcher-change with roots_by_category so the UI runs each scanner only on those subtrees.

Structsยง

FileWatcherState
State for the file watcher.

Constantsยง

PLUGIN_EXTS ๐Ÿ”’
Plugin extensions.

Functionsยง

classify ๐Ÿ”’
Classify a file path into a change category.
get_watched_dirs
Get the list of currently watched directories.
is_watching
Check if the watcher is active.
minimize_scan_roots ๐Ÿ”’
Drop redundant roots: if /a and /a/b both changed, keep only /a.
scan_root_for_changed_path ๐Ÿ”’
Directory to pass to scanners: bundle dirs (.vst3, .logicx, โ€ฆ) as-is; files use their parent folder.
start_watching
Start watching the given directories for file changes. Debounces events and emits file-watcher-change to the frontend.
stop_watching
Stop the file watcher.