This has nagged me for a long time, but the definition of
home_dir in std is pretty arguably incorrect on Windows, and both rustup and cargo use their own custom definition.
The problem with it is that it prioritizes the
HOME variable, which basically has no meaning on windows (the correct variable is “USERPROFILE”).
The practical result of this is that calls to
home_dir on most windows environments result in a path like
C:\Users\brson, but under cygwin and mingw result in things like
Now, I have no doubt that is useful in some case, but I have not found that case yet, and find the function extremely misleading. When we found it in rustup and cargo, we felt like it was completely bogus and confusing behavior.
There might be a place for this function in the world, but I do not believe it is
env::home_dir, and suggest deprecating it.