aboutsummaryrefslogtreecommitdiff
path: root/helix-loader
diff options
context:
space:
mode:
authorBjorn Ove Hay Andersen2023-10-09 16:38:09 +0000
committerGitHub2023-10-09 16:38:09 +0000
commita8574805617d86304232b47d84fd7c7f4f773520 (patch)
tree9769a097d881c4330a71e79bdcee0bb279b0fb9f /helix-loader
parent5cb76e74f9bd226f1b4757f478bf49873d9ecfe6 (diff)
Set the working directory before loading the config (#8498)
Diffstat (limited to 'helix-loader')
-rw-r--r--helix-loader/src/lib.rs6
1 files changed, 3 insertions, 3 deletions
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<Path>) -> 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);