use std::{path::Path, time::Duration};
use notify_debouncer_mini::{new_debouncer, notify::RecursiveMode, DebounceEventResult};
fn main() {
let mut debouncer = new_debouncer(Duration::from_secs(1), |res: DebounceEventResult| {
match res {
Ok(events) => events.iter().for_each(|_event| {
std::process::Command::new("cargo")
.arg("build")
.status()
.expect("Failed to execute command");
}),
Err(e) => println!("Error {:?}",e),
}
}).unwrap();
debouncer.watcher().watch(Path::new("resources"), RecursiveMode::Recursive).unwrap();
}