Skip to content

Commit cdf3f62

Browse files
committed
Use home crate.
1 parent bcad053 commit cdf3f62

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed

Cargo.lock

Lines changed: 27 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ edition = "2018"
1313
[dependencies]
1414
atty = "0.2"
1515
error-chain = "0.12"
16+
home = "0.5"
1617
lazy_static = "1.0"
1718
libc = "0.2.18"
1819
rustc_version = "0.2"

src/docker.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ pub fn run(target: &Target,
7878
verbose: bool)
7979
-> Result<ExitStatus> {
8080
let root = root.path();
81-
let home_dir = env::home_dir().ok_or_else(|| "couldn't get home directory. Is $HOME not set?")?;
82-
let cargo_dir = env::var_os("CARGO_HOME")
83-
.map(PathBuf::from)
84-
.unwrap_or_else(|| home_dir.join(".cargo"));
81+
let home_dir = home::home_dir().ok_or_else(|| "could not find home directory")?;
82+
let cargo_dir = home::cargo_home()?;
8583
let xargo_dir = env::var_os("XARGO_HOME")
8684
.map(PathBuf::from)
8785
.unwrap_or_else(|| home_dir.join(".xargo"));

src/errors.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
use error_chain::error_chain;
44

5-
error_chain!();
5+
error_chain! {
6+
foreign_links {
7+
Io(std::io::Error);
8+
}
9+
}

0 commit comments

Comments
 (0)