mirror of
https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials.git
synced 2024-11-15 18:14:02 +00:00
8c661977b8
This is finally possible since the new feature resolver. For reference: https://github.com/rust-lang/rust-analyzer/issues/6197#issuecomment-827564835
21 lines
514 B
Rust
21 lines
514 B
Rust
use std::{env, fs, process};
|
|
|
|
fn main() {
|
|
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()));
|
|
}
|