-
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
Use OS-native config, cache home directories #1734
Comments
Have been stumped by this as well. Looked for Cargo's config in |
@0X1A If the respective |
Is someone working on this ? The more we wait, the more difficult it will be to change the default. |
@Yamakaky AFAIK there isn't anything being done about it |
You can use my xdg crate to implement this. |
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html http://www.freedesktop.org/software/systemd/man/file-hierarchy.html 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 XDG directories if they exist. 3) Use the legacy location (~/.cargo) if it exists. 4) Fall back the XDG directories if everything else fails. Fixes rust-lang#1734.
cargo install now installs into |
... and it really should use |
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.
@tbu- any progress? |
@Stebalien Waiting for rust-lang/rfcs#1615. |
It's the only thing I missed in rust ecosystem! Or to separate the patch into three platform so that it will be available on partial inclusion. |
I'll rebase the patch or the partial patch if this gets accepted. This won't be the problem. |
I don’t know where this came from, but on Linux I apparently have both
|
@sanmai-NL Where does your |
I have no idea, probably just some leftover from messing around when there was no Arch Linux package for Cargo yet. Note that my |
Another issue with not respecting XDG: backups. My current backup profiles knows that it should avoid |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
It would be much appreciated if people can take look at and share their user stories in the pre-RFC. That's one way out to address this long-standing issue. |
Good to know! |
@weihanglo thank you for a link |
This comment was marked as off-topic.
This comment was marked as off-topic.
This is not the same. XDG defines configuration in $HOME/.config/ and cache in $HOME/.cache (and other directories). As far as I know, you can't do that with |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I'd say that mostly does not fulfill the need of people coming to this issue, who usually want to split managing caches, configs and data. It's also stated in the previous postponed RFC rust-lang/rfcs#1615.
As a NixOS user who manages immutable cargo config with Nix, I have to do dirty symlink tricks to split In this time, I strongly agree this comment from previous RFC
This issue is bothering a lot for us as cargo users, who may or may not have cargo development skills, while many (maybe only little?) cargo developer more lean towards keeping the current non-ergonomic situation with the reason of "compatibility"1 or "always has been". So the only way left for us users to do is ranting out and gaining attention to show that the current situation is not as good as they think. Footnotes
|
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm unlocking this and hiding the most of the recent posts. I would ask that people be respectful to others and that includes not assigning intent to others I think a general assumption we can make is that we all want what is best for the users of cargo. A summary of the conversation from some of the hidden posts:
|
I think, that I know a hacky solution for locating build directory (
alias cargo = 'CARGO_TARGET_DIR=$XDG_CACHE_DIR/rust-builds/$(cargo metadata --no-deps --offline | extract_name_magic) cargo' Where By using this alias, you'll get all the cargo commands working as expected with separate XDG-compliant build directories for each project. Tomorrow I'll implement |
FYI this is about everything in the home directory today. There is a separate issue (and an open RFC!) about centralizing target dirs. On mobile or I'd get you the linksd |
See rust-lang/rfcs#3371 and #11156 (if I got it correctly). |
I believe this was from the Pre RFC thread https://internals.rust-lang.org/t/pre-rfc-split-cargo-home/19747/26 |
FWIW |
For Linux-like systems, we should be using XDG. See arch's wiki for a non-exhaustive list of software with varying degrees of compliance.
For Windows, 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.The text was updated successfully, but these errors were encountered: