Canonical definitions of
This provides the definition of
home_dir used by Cargo and
rustup, as well functions to find the correct value of
See also the
Note that as of 2019/08/06 it appears that cargo uses this crate. And rustup has used this crate since 2019/08/21.
The definition of
home_dir provided by the standard library is
incorrect because it considers the
HOME environment variable on
Windows. This causes surprising situations where a Rust program
will behave differently depending on whether it is run under a
Unix emulation environment like Cygwin or MinGW. Neither Cargo nor
rustup use the standard libraries definition - they use the
This crate further provides two functions,
rustup_home, which are the canonical way to determine the
location that Cargo and rustup store their data.
See also this discussion.
Returns the storage directory used by Cargo, often knowns as
Returns the storage directory used by Cargo within
Returns the path of the current user's home directory if known.
Returns the storage directory used by rustup, often knowns as
Returns the storage directory used by rustup within