rust-raspberrypi-OS-tutorials/09_privilege_level/build.rs

21 lines
514 B
Rust
Raw Normal View History

2022-04-12 19:58:40 +00:00
use std::{env, fs, process};
fn main() {
2022-04-12 19:58:40 +00:00
let ld_script_path = match env::var("LD_SCRIPT_PATH") {
Ok(var) => var,
_ => process::exit(0),
};
let files = fs::read_dir(ld_script_path).unwrap();
files
.filter_map(Result::ok)
.filter(|d| {
if let Some(e) = d.path().extension() {
e == "ld"
} else {
false
}
})
.for_each(|f| println!("cargo:rerun-if-changed={}", f.path().display()));
}