mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
Simplify get_install_path
using cargo_home
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
79476e490b
commit
5620810c55
1 changed files with 3 additions and 14 deletions
|
@ -187,20 +187,9 @@ pub fn get_install_path<P: AsRef<Path>>(install_path: Option<P>) -> (Option<Path
|
||||||
return (Some(b.join("bin")), true);
|
return (Some(b.join("bin")), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(p) = std::env::var("CARGO_HOME") {
|
if let Ok(p) = cargo_home() {
|
||||||
debug!("using CARGO_HOME ({p})");
|
debug!("using ({}) as cargo home", p.display());
|
||||||
let b = PathBuf::from(p);
|
return (Some(p.into()), false);
|
||||||
return (Some(b.join("bin")), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Standard $HOME/.cargo/bin
|
|
||||||
if let Some(d) = dirs::home_dir() {
|
|
||||||
let d = d.join(".cargo/bin");
|
|
||||||
if d.exists() {
|
|
||||||
debug!("using $HOME/.cargo/bin");
|
|
||||||
|
|
||||||
return (Some(d), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local executable dir if no cargo is found
|
// Local executable dir if no cargo is found
|
||||||
|
|
Loading…
Add table
Reference in a new issue