From a8574805617d86304232b47d84fd7c7f4f773520 Mon Sep 17 00:00:00 2001 From: Bjorn Ove Hay Andersen Date: Mon, 9 Oct 2023 18:38:09 +0200 Subject: Set the working directory before loading the config (#8498) --- helix-loader/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'helix-loader') diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 7ff4cada..82ed2ede 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -33,9 +33,9 @@ pub fn current_working_dir() -> PathBuf { path } -pub fn set_current_working_dir(path: PathBuf) -> std::io::Result<()> { +pub fn set_current_working_dir(path: impl AsRef) -> std::io::Result<()> { let path = dunce::canonicalize(path)?; - std::env::set_current_dir(path.clone())?; + std::env::set_current_dir(&path)?; let mut cwd = CWD.write().unwrap(); *cwd = Some(path); Ok(()) @@ -280,7 +280,7 @@ mod merge_toml_tests { let cwd = current_working_dir(); assert_ne!(cwd, new_path); - set_current_working_dir(new_path.clone()).expect("Couldn't set new path"); + set_current_working_dir(&new_path).expect("Couldn't set new path"); let cwd = current_working_dir(); assert_eq!(cwd, new_path); -- cgit v1.2.3-70-g09d2