Skip to content
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

Closed
briansmith opened this issue Sep 8, 2015 · 7 comments
Closed

Windows: Cargo should put files in ~/appdata, not directly in ~/ #1976

briansmith opened this issue Sep 8, 2015 · 7 comments
Labels
A-configuration Area: cargo config files and env vars S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@briansmith
Copy link

briansmith commented Sep 8, 2015

In particular, everything should go in ~/appdata/locallow or ~/appdata/local,since ~/.cargo is just a cache, AFAICT.

This is FOLDERID_LocalAppData for SHGetKnownFolderPath, CSIDL_LOCAL_APPDATA for SHGetFolderPath, and %LOCALAPPDATA% in the environment.

See also #1734

@alexcrichton
Copy link
Member

cc #1734, a similar ish issue for linux

@alexcrichton alexcrichton added the A-configuration Area: cargo config files and env vars label Sep 9, 2015
@briansmith
Copy link
Author

A practical reason for doing this is to avoid having automated backup/sync software backup/sync the .cargo directory.

@DanielKeep
Copy link

cargo-script already does this, using this code. Feel free to steal :)

Disclaimer on the function:

This is not chosen to match the location where Cargo places its cache data, because Cargo is wrong. This is at least less wrong.

tbu- added a commit to tbu-/cargo that referenced this issue Jan 25, 2016
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.
soc added a commit to soc/cargo that referenced this issue Mar 15, 2018
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
soc added a commit to soc/cargo that referenced this issue Apr 28, 2018
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
@stale
Copy link

stale bot commented Nov 14, 2018

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:

  • Is this still relevant?
  • If so, what is blocking it?
  • Is it known what could be done to help move this forward?

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!

@stale stale bot added the stale label Nov 14, 2018
@retep998
Copy link
Member

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.

@stale stale bot removed the stale label Nov 14, 2018
@weihanglo weihanglo added the S-needs-team-input Status: Needs input from team on whether/how to proceed. label May 14, 2023
@epage
Copy link
Contributor

epage commented May 24, 2023

@epage
Copy link
Contributor

epage commented Sep 28, 2023

FYI I've generalized #1734 to cover all OS as we need to address them all together. Closing this in favor of that issue.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

6 participants