rust-lang / rust-lang/rfcs

Add a function to access application data directory

Open
#1,159 6 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-libs
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Currently there is only a way to easily store application specific data using the standard library, std::env::home_dir. That's not a quite correct way. I was thinking about the addition of a std::env::appdata_dir function?

The home directory is only suitable for storing application data on Linux (and perhaps other *nixes?), on Windows the correct place is %AppData% or %LocalAppData% and on OSX it seems to be ~/Library/Preferences/ or ~/Library/Application Support/.

That brought my attention when I noticed that Cargo stores it's data on %USERPROFILE%/.cargo/ (std::env::home_dir gives%USERPROFILE on Windows), note how directories starting with . aren't hidden on Windows and those pollute the user profile directory.

However I have a few concerns about this myself:

  • Not sure whether std::env should have functions that aren't directly a enviroment variable (e.g. ~/Library/...) though it says and various other important directories on it's description.
  • Storing application data might be more complicated than that (especially on OSes not mentioned here) and it'd thus be better to have this kind of feature as a separate user crate.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing std::env::home_dir and the platform-specific locations listed in the issue. Resolve whether an appdata_dir API belongs in std::env or a separate crate, define supported operating-system behavior, and document the accepted design as done.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.