Support platform-defined standard directories by soc · Pull Request #5183 · rust-lang/cargo

spacekookie added a commit to spacekookie/cargo that referenced this pull request

@spacekookie

This commit is a continuation and adaptation of rust-lang#5183, which aimed to
make cargo no longer reliant on the `$HOME/.cargo` directory in user's
home's, and instead uses the `directories` crate to get
platform-defined standard directories for data, caches, and configs.

The priority of paths cargo will check is as follows:

1. Use `$CARGO_HOME`, if it is set
2. Use `$CARGO_CACHE_DIR`, `$CARGO_CONFIG_DIR`, etc, if they are set
3. If no environment variables are set, and `$HOME/.cargo` is present,
   use that
4. Finally, use the platform-default directory paths