diff options
Diffstat (limited to 'helix-stdx/src/env.rs')
-rw-r--r-- | helix-stdx/src/env.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/helix-stdx/src/env.rs b/helix-stdx/src/env.rs index 864ba828..3676727f 100644 --- a/helix-stdx/src/env.rs +++ b/helix-stdx/src/env.rs @@ -1,3 +1,5 @@ +pub use which::which; + use std::{ path::{Path, PathBuf}, sync::RwLock, @@ -30,6 +32,14 @@ pub fn set_current_working_dir(path: impl AsRef<Path>) -> std::io::Result<()> { Ok(()) } +pub fn env_var_is_set(env_var_name: &str) -> bool { + std::env::var_os(env_var_name).is_some() +} + +pub fn binary_exists(binary_name: &str) -> bool { + which::which(binary_name).is_ok() +} + #[cfg(test)] mod tests { use super::{current_working_dir, set_current_working_dir}; |