diff --git a/Cargo.lock b/Cargo.lock index 3bd175ed1b..7d42c76130 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2631,7 +2631,7 @@ dependencies = [ "glob", "globset", "heck 0.5.0", - "home", + "homedir", "humantime", "indenter", "indexmap 2.7.0", diff --git a/Cargo.toml b/Cargo.toml index fd16cecf41..e3fcb5319f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,6 +68,7 @@ digest = "0.10.7" dotenvy = "0.15" duct = "0.13" either = { version = "1", features = ["serde"] } +homedir = "0.3" # expr-lang = { path = "../expr-lang" } expr-lang = "0.2" eyre = "0.6" @@ -78,7 +79,6 @@ git2 = "<1" glob = "0.3" globset = "0.4" heck = "0.5" -home = "0.5" humantime = "2" indenter = "0.3" indexmap = { version = "2", features = ["serde"] } diff --git a/src/env.rs b/src/env.rs index 8dd8e0d255..21288afa8e 100644 --- a/src/env.rs +++ b/src/env.rs @@ -23,8 +23,12 @@ pub static SHELL: Lazy = Lazy::new(|| var("COMSPEC").unwrap_or_else(|_| pub static HOME: Lazy = Lazy::new(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test")); #[cfg(not(test))] -pub static HOME: Lazy = - Lazy::new(|| home::home_dir().unwrap_or_else(|| PathBuf::from("/"))); +pub static HOME: Lazy = Lazy::new(|| { + homedir::my_home() + .ok() + .flatten() + .unwrap_or_else(|| PathBuf::from("/")) +}); pub static EDITOR: Lazy = Lazy::new(|| var("VISUAL").unwrap_or_else(|_| var("EDITOR").unwrap_or_else(|_| "nano".into())));