Skip to main content

resolve_watch_targets

Function resolve_watch_targets 

Source
fn resolve_watch_targets(paths: &[PathBuf]) -> WatchTargets
Expand description

Resolves every path component by component, following symlinks, and collects what has to be watched to notice any change of what the path points to.

For each symlink met on the way (the file itself or any ancestor directory), the directory holding it is watched, so replacing the symlink is noticed. The directory holding the final file is watched too, so in-place edits are noticed. The collected directories are free of symlinks; the collected entries are the symlinks themselves and the final files, located inside those directories.

If a component is missing (e.g. a symlink being swapped non-atomically), resolution of that path stops and its containing directory is watched, so the watch is re-armed once the component shows up again.