yarte_helpers/
recompile.rs1use std::fs;
2
3use crate::config::{config_file_path, read_config_file, Config};
4
5pub fn when_changed() {
7 println!(
9 "cargo:rerun-if-changed={}",
10 config_file_path().to_str().unwrap()
11 );
12
13 let file = read_config_file();
14 let config = Config::new(&file);
15
16 let mut stack = vec![config.get_dir().clone()];
17 while let Some(dir) = stack.pop() {
18 println!("cargo:rerun-if-changed={}", dir.to_str().unwrap());
20 for entry in fs::read_dir(dir).expect("valid directory") {
21 let path = entry.expect("valid directory entry").path();
22 if path.is_dir() {
23 stack.push(path);
24 } else {
25 println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
27 }
28 }
29 }
30}