mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 14:31:30 +03:00
logic simplified
This commit is contained in:
parent
a77f3ad6e3
commit
21d59b5e05
@ -48,16 +48,16 @@ pub fn resolve_vscode_variant() -> &'static str {
|
||||
}
|
||||
|
||||
fn check_if_installed(executable_name: &str) -> bool {
|
||||
let paths = match env::var_os("PATH") {
|
||||
Some(path) => env::split_paths(&path).collect::<Vec<_>>(),
|
||||
None => vec![],
|
||||
};
|
||||
|
||||
paths.into_iter().any(|mut path| {
|
||||
path.push(executable_name);
|
||||
//println!("{}", path.to_string_lossy());
|
||||
fs::metadata(path).is_ok()
|
||||
})
|
||||
match env::var_os("PATH") {
|
||||
Some(env_path) => env::split_paths(&env_path)
|
||||
.filter_map(|mut path| {
|
||||
path.push(executable_name);
|
||||
fs::metadata(path).ok()
|
||||
})
|
||||
.next()
|
||||
.is_some(),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build(_package_info: &PackageInfo) -> Menu {
|
||||
|
Loading…
Reference in New Issue
Block a user