Skip to content

Commit

Permalink
Use home cargo crate instead of simple-home-dir (#534)
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Pierre Geslin <jarsop@outlook.com>
  • Loading branch information
Jarsop authored Jan 16, 2024
1 parent 55940c2 commit b96314c
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 27 deletions.
86 changes: 76 additions & 10 deletions 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 rye/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ same-file = "1.0.6"
serde = { version = "1.0.160", features = ["derive"] }
serde_json = "1.0.94"
shlex = "1.1.0"
simple-home-dir = "0.1.2"
slug = "0.1.4"
tar = "0.4.38"
tempfile = "3.5.0"
Expand All @@ -59,6 +58,7 @@ configparser = "3.0.2"
monotrail-utils = { git = "https://github.com/konstin/poc-monotrail", version = "0.0.1" }
python-pkginfo = { version = "0.5.6", features = ["serde"] }
sysinfo = { version = "0.29.4", default-features = false, features = [] }
home = "0.5.9"

[target."cfg(unix)".dependencies]
whattheshell = "1.0.1"
Expand Down
19 changes: 3 additions & 16 deletions rye/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,9 @@ pub fn init() -> Result<(), Error> {
let home = if let Some(rye_home) = env::var_os("RYE_HOME") {
PathBuf::from(rye_home)
} else {
{
// ironically the deprecated home dir implementation is
// still the only one that falls back to getpwuid.
// Fixes https://github.com/mitsuhiko/rye/issues/532
#[cfg(unix)]
{
#[allow(deprecated)]
std::env::home_dir()
}
#[cfg(not(unix))]
{
simple_home_dir::home_dir()
}
}
.map(|x| x.join(".rye"))
.ok_or_else(|| anyhow!("could not determine home folder"))?
home::home_dir()
.map(|x| x.join(".rye"))
.ok_or_else(|| anyhow!("could not determine home folder"))?
};
*APP_DIR.lock().unwrap() = Some(Box::leak(Box::new(home)));
Ok(())
Expand Down

0 comments on commit b96314c

Please sign in to comment.