Find an executable in the `PATH`.
(exe_name: impl AsRef<Path>)
| 4 | |
| 5 | /// Find an executable in the `PATH`. |
| 6 | pub(crate) fn find_executable(exe_name: impl AsRef<Path>) -> Option<std::path::PathBuf> { |
| 7 | std::env::var_os("PATH").and_then(|paths| { |
| 8 | std::env::split_paths(&paths) |
| 9 | .map(|dir| dir.join(&exe_name)) |
| 10 | .find(|x| x.is_file()) |
| 11 | }) |
| 12 | } |
| 13 | |
| 14 | /// Check if `rustup` is installed (aka: Is in the `PATH`). |
| 15 | pub(crate) fn has_rust_up() -> bool { |
no test coverage detected
searching dependent graphs…