-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: Cargo should put files in ~/appdata, not directly in ~/ #1976
Comments
cc #1734, a similar ish issue for linux |
A practical reason for doing this is to avoid having automated backup/sync software backup/sync the .cargo directory. |
Disclaimer on the function:
|
Strategy for backward-compatiblity: When checking for the relevant Cargo directories, check in the following order of preference: 1) Use the environment variable `CARGO_HOME`. 2) Use the platform-specific directories if they exist. 3) Use the legacy location (~/.cargo) if it exists. 4) Fall back to the platform-specific directories if everything else fails. The new platform-specific directories are as follows: On Windows, use `AppData\Local\Temp\Cargo` for cache files (obtained via `GetTempPath`), `AppData\Roaming\Cargo` for the config files (`FOLDERID_RoamingAppData`) and `AppData\Local\Programs\Cargo` for installed binaries (`FOLDERID_UserProgramFiles`). On Unixy systems, use the XDG spec: `~/.cache/cargo` for cache files, `~/.config/cargo` for config, `~/.local/bin` for installed binaries. http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html http://www.freedesktop.org/software/systemd/man/file-hierarchy.html On OS X, use `~/Library/Caches/Cargo` for cache files, `~/Library/Cargo` for config files and `~/Library/Cargo/bin` for binary files. Fixes rust-lang#1734. Fixes rust-lang#1976.
This change stops cargo from violating the operating system rules regarding the placement of config, cache, ... directories on Linux, macOS and Windows. Existing directories and overrides are retained. The precedence is as follows: 1) use the `CARGO_HOME` environment variable if it exists (legacy) 2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist 3) use the ~/.cargo directory if it exists (legacy) 4) follow operating system standards A new cargo command, `dirs`, is added, which can provide path information to other command line tools. Fixes: rust-lang#1734 rust-lang#1976 rust-lang/rust#12725 Addresses: rust-lang/rfcs#1615 rust-lang#148, rust-lang#3981
This change stops cargo from violating the operating system rules regarding the placement of config, cache, ... directories on Linux, macOS and Windows. Existing directories and overrides are retained. The precedence is as follows: 1) use the `CARGO_HOME` environment variable if it exists (legacy) 2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist 3) use the ~/.cargo directory if it exists (legacy) 4) follow operating system standards A new cargo command, `dirs`, is added, which can provide path information to other command line tools. Fixes: rust-lang#1734 rust-lang#1976 rust-lang/rust#12725 Addresses: rust-lang/rfcs#1615 rust-lang#148, rust-lang#3981
As there hasn't been any activity here in a while would someone (the author, a team member, or any interested party) be able to summarise the current state, perhaps making explicit:
Thank you! (The cargo team is currently evaluating the use of Stale bot, and using #6035 as the tracking issue to gather feedback.) If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable! |
There has still been no movement on this front. The RFC is still open and the relevant teams still are unsure of themselves. Several implementations have popped up over time, and they've all been closed for various reasons. |
https://poignardazur.github.io/2023/05/23/platform-compliance-in-cargo/ for a summary of this |
FYI I've generalized #1734 to cover all OS as we need to address them all together. Closing this in favor of that issue. |
In particular, everything should go in ~/appdata/locallow or ~/appdata/local,since ~/.cargo is just a cache, AFAICT.
This is
FOLDERID_LocalAppData
forSHGetKnownFolderPath
,CSIDL_LOCAL_APPDATA
forSHGetFolderPath
, and%LOCALAPPDATA%
in the environment.See also #1734
The text was updated successfully, but these errors were encountered: