pub fn rerun_in_except(
    run_in: impl AsRef<Path>,
    except: &[impl AsRef<Path>]
) -> Result<String>
Expand description

Return cargo rerun-if-changed lines to rerun build script if files in folder are changed, excluding listed

Takes the directory to check, and a slice of files under that directory to exclude. Returns a string in the format:

cargo:rerun-if-changed=path/to/folder/test.c
cargo:rerun-if-changed=path/to/folder/test.h

Errors

Errors if the directory cannot be read. Any invalid files will be skipped.

Example

println!("{}", rerun_in_except("./frontend", &["./frontend/node_modules", "./frontend/artifacts"]).unwrap())