Skip to content

Commit

Permalink
chore: switch from home -> homedir crate
Browse files Browse the repository at this point in the history
home is apparently not to be used outside of cargo
  • Loading branch information
jdx committed Dec 20, 2024
1 parent 4727339 commit 2dd0ce7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"] }
Expand Down
8 changes: 6 additions & 2 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
Expand Down

0 comments on commit 2dd0ce7

Please sign in to comment.