| 1 |
[](https://docs.rs/home) |
| 2 |
[](https://crates.io/crates/home) |
| 3 |
|
| 4 |
Canonical definitions of `home_dir`, `cargo_home`, and `rustup_home`. |
| 5 |
|
| 6 |
This provides the definition of `home_dir` used by Cargo and rustup, |
| 7 |
as well functions to find the correct value of `CARGO_HOME` and |
| 8 |
`RUSTUP_HOME`. |
| 9 |
|
| 10 |
The definition of `home_dir` provided by the standard library is |
| 11 |
incorrect because it considers the `HOME` environment variable on |
| 12 |
Windows. This causes surprising situations where a Rust program will |
| 13 |
behave differently depending on whether it is run under a Unix |
| 14 |
emulation environment like Cygwin or MinGW. Neither Cargo nor rustup |
| 15 |
use the standard library's definition - they use the definition here. |
| 16 |
|
| 17 |
This crate further provides two functions, `cargo_home` and |
| 18 |
`rustup_home`, which are the canonical way to determine the location |
| 19 |
that Cargo and rustup store their data. |
| 20 |
|
| 21 |
See [rust-lang/rust#43321]. |
| 22 |
|
| 23 |
[rust-lang/rust#43321]: https://github.com/rust-lang/rust/issues/43321 |
| 24 |
|
| 25 |
## License |
| 26 |
|
| 27 |
MIT OR Apache-2.0 |