logic simplified

This commit is contained in:
TheGB0077 2024-06-03 14:28:04 -03:00
parent a77f3ad6e3
commit 21d59b5e05

View File

@ -48,16 +48,16 @@ pub fn resolve_vscode_variant() -> &'static str {
} }
fn check_if_installed(executable_name: &str) -> bool { fn check_if_installed(executable_name: &str) -> bool {
let paths = match env::var_os("PATH") { match env::var_os("PATH") {
Some(path) => env::split_paths(&path).collect::<Vec<_>>(), Some(env_path) => env::split_paths(&env_path)
None => vec![], .filter_map(|mut path| {
}; path.push(executable_name);
fs::metadata(path).ok()
paths.into_iter().any(|mut path| { })
path.push(executable_name); .next()
//println!("{}", path.to_string_lossy()); .is_some(),
fs::metadata(path).is_ok() None => false,
}) }
} }
pub fn build(_package_info: &PackageInfo) -> Menu { pub fn build(_package_info: &PackageInfo) -> Menu {