1 2 3 4 5 6 7 8 9 10 11 12 13 14
use std::fs; use std::path::Path; use which::which; pub fn check_cmd(program: &str) -> bool { match which(program) { Err(_) => false, _ => true, } } pub fn check_path<P: AsRef<Path>>(path: P) -> bool { fs::metadata(path).is_ok() }