Home crate 0.4.1 released

The home crate provides platform-specific definitions of the "home" directory as well as definitions of the CARGO_HOME and RUSTUP_HOME directory. If you need to identify cargo or rustup's installation directory, this is probably the crate you want, but note the caveats below.

This new release includes a bunch of cleanup by @lzutao (thanks!), particularly to stop building winapi crates on not-windows. So if you are using this crate, this release is probably a worthwhile update over the previous 0.3 series.

Since locating cargo and rustup's home directories is not simple (there's historical baggage), this crate was written to be the canonical definition of the two locations. As of today it appears that cargo does use this crate, but rustup instead uses the home_dir definition from the dirs crate plus open-coded logic for locating RUSTUP_HOME and CARGO_HOME. I don't recall how this situation came to be, where cargo is sharing it's home-dir logic but rustup is not, and no longer know how close the logic in this crate corresponds to rustup's actual logic (they probably used to be identical). I think rustup should be sharing its logic so that other tools can correctly identify its installation directory, and so rustup and cargo agree on CARGO_HOME.

This crate is lightly maintained, and I do not know how the home_dir function within corresponds to the home_dir function in the officially-recommended dirs crate. For general-purpose "home" directory logic it is probably wiser to use the dirs crate.

4 Likes

A PR to make use of the home crate in rustup is already in progress :slight_smile: https://github.com/rust-lang/rustup.rs/pull/1919

2 Likes

Cool @matthiaskrgr! Thanks.

I left a comment on that PR adding some context about the relationship between rustup and home. Note that home is not an official Rust project though it was written for the purpose of unifying cargo, rustup, and other tools' notion of CARGO_HOME and RUSTUP_HOME. I am happy to add any other maintainers or transfer ownership to someone more attentive and dedicated than I.

1 Like

I'm interested in maintaining it @brson .

@lzutao thank you! I've merged your windows fix and published it as 0.4.2, and invited you to be a GitHub collaborator and cargo owner.

Thank you.

@brson Could you set Travis hook to home repo? I am going to add some Travis config to it.

1 Like

@lzutao I turned on travis and committed a basic .travis.yml

1 Like