diff --git a/helix-stdx/src/env.rs b/helix-stdx/src/env.rs index b3f46c25f..6f9a091e4 100644 --- a/helix-stdx/src/env.rs +++ b/helix-stdx/src/env.rs @@ -1,3 +1,4 @@ +//! Functions for working with the host environment. use std::{ borrow::Cow, ffi::{OsStr, OsString}, @@ -10,9 +11,9 @@ use once_cell::sync::Lazy; // We keep the CWD as a static so that we can access it in places where we don't have access to the Editor static CWD: RwLock> = RwLock::new(None); -// Get the current working directory. -// This information is managed internally as the call to std::env::current_dir -// might fail if the cwd has been deleted. +/// Get the current working directory. +/// This information is managed internally as the call to std::env::current_dir +/// might fail if the cwd has been deleted. pub fn current_working_dir() -> PathBuf { if let Some(path) = &*CWD.read().unwrap() { return path.clone(); @@ -37,6 +38,7 @@ pub fn current_working_dir() -> PathBuf { cwd } +/// Update the current working directory. pub fn set_current_working_dir(path: impl AsRef) -> std::io::Result> { let path = crate::path::canonicalize(path); std::env::set_current_dir(&path)?; @@ -45,14 +47,17 @@ pub fn set_current_working_dir(path: impl AsRef) -> std::io::Result