chore: switch from home -> homedir crate (#3743)

home is apparently not to be used outside of cargo
This commit is contained in:
jdx 2024-12-20 11:34:44 -06:00 committed by GitHub
parent 4727339de1
commit 1f0c01b0ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

2
Cargo.lock generated
View File

@ -2631,7 +2631,7 @@ dependencies = [
"glob",
"globset",
"heck 0.5.0",
"home",
"homedir",
"humantime",
"indenter",
"indexmap 2.7.0",

View File

@ -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"] }

View File

@ -23,8 +23,12 @@ pub static SHELL: Lazy<String> = Lazy::new(|| var("COMSPEC").unwrap_or_else(|_|
pub static HOME: Lazy<PathBuf> =
Lazy::new(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test"));
#[cfg(not(test))]
pub static HOME: Lazy<PathBuf> =
Lazy::new(|| home::home_dir().unwrap_or_else(|| PathBuf::from("/")));
pub static HOME: Lazy<PathBuf> = Lazy::new(|| {
homedir::my_home()
.ok()
.flatten()
.unwrap_or_else(|| PathBuf::from("/"))
});
pub static EDITOR: Lazy<String> =
Lazy::new(|| var("VISUAL").unwrap_or_else(|_| var("EDITOR").unwrap_or_else(|_| "nano".into())));