Why are .rustup and .cargo in the user directory? (Windows)

Would it not be more appropriate to put them somewhere like C:\Program Files\Rust? Windows isn't Linux, after all.

These directories are per-user, not per-system. There may be a better place for them, but they shouldn't be in a system-wide-shared location like Program Files.

4 Likes

They should likely be somewhere in AppData in the user profile on Windows, and split out into parts following the XDG spec on Linux (e.g. ~/.cache and ~/.local). The current state of affair is extremely suboptimal.

2 Likes

See also Pre-RFC: Split `CARGO_HOME`

7 Likes

Well, question 0 here would be if they have any reason to be per-user to begin with. But that aside, as Vorpal said it would be more appropriate to store them somewhere like AppData in that case anyway.

TOCTOU issues still lurk even when doing hash verification and git checkouts are hardly atomic in any real sense to have these things shared. Without some (really) fancy shim that works to prevent tampering and/or badly seeding a cache from another user, these things really should be per-user.