fn register_seccompiler_src_watchlist(src_dir: &Path) {
    let contents = fs::read_dir(src_dir).expect("Unable to read folder contents.");
    for entry in contents {
        let path = entry.unwrap().path();
        let metadata = fs::metadata(&path).expect("Unable to read file/folder metadata.");

        if metadata.is_file() {
            // Watch all source files.
            println!(
                "cargo:rerun-if-changed={}",
                path.to_str().expect("Invalid unicode bytes.")
            );
        } else if metadata.is_dir() {
            // If is a folder, recurse.
            register_seccompiler_src_watchlist(&path);
        }
    }
}
// Recursively traverse the entire seccompiler source folder and trigger a re-run of this build
// script on any modification of these files.
Recursively traverse the entire seccompiler source folder and trigger a re-run of this build
script on any modification of these files.
Recursively traverse the entire seccompiler source folder and trigger a re - run of this build script on any modification of these files .
fn register_seccompiler_src_watchlist(src_dir: &Path) {
    let contents = fs::read_dir(src_dir).expect("Unable to read folder contents.");
    for entry in contents {
        let path = entry.unwrap().path();
        let metadata = fs::metadata(&path).expect("Unable to read file/folder metadata.");
        if metadata.is_file() {
            // Watch all source files.
            println!(
                "cargo:rerun-if-changed={}",
                path.to_str().expect("Invalid unicode bytes.")
            );
        } else if metadata.is_dir() {
            // If is a folder, recurse.
            register_seccompiler_src_watchlist(&path);
        }
    }
}
fn register_seccompiler_src_watchlist ( src_dir : & Path ) { let contents = fs :: read_dir ( src_dir ) . expect ( " " ) ; for entry in contents { let path = entry . unwrap ( ) . path ( ) ; let metadata = fs :: metadata ( & path ) . expect ( " " ) ; if metadata . is_file ( ) { // Watch all source files. println ! ( " " path to_str ( ) expect ( " " ) ) ; } else if metadata . is_dir ( ) { // If is a folder, recurse. register_seccompiler_src_watchlist ( & path ) ; } } }
Recursively traverse the entire seccompiler source folder and trigger a re-run of this build
script on any modification of these files.
Recursively traverse the entire seccompiler source folder and trigger a re - run of this build script on any modification of these files .
src_dir
&Path
src_dir
&Path