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

Update readme to reflect actual behavior of user directory functions #2535

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1903,14 +1903,20 @@ for details.
@echo '{{ style("error") }}OH NO{{ NORMAL }}'
```

##### XDG Directories<sup>1.23.0</sup>
##### User Directories<sup>1.23.0</sup>

These functions return paths to user-specific directories for things like
configuration, data, caches, executables, and the user's home directory. These
functions follow the
[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html),
and are implemented with the
[`dirs`](https://docs.rs/dirs/latest/dirs/index.html) crate.
configuration, data, caches, executables, and the user's home directory.

On Unix, these functions follow the
[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

On MacOS and Windows, these functions return the system-specified user-specific
directories. For example, `cache_directory()` returns `~/Library/Caches` on
MacOS and `{FOLDERID_LocalAppData}` on Windows.

See the [`dirs`](https://docs.rs/dirs/latest/dirs/index.html) crate for more
details.

- `cache_directory()` - The user-specific cache directory.
- `config_directory()` - The user-specific configuration directory.
Expand All @@ -1920,6 +1926,10 @@ and are implemented with the
- `executable_directory()` - The user-specific executable directory.
- `home_directory()` - The user's home directory.

If you would like to use XDG base directories on all platforms you can use the
`env(…)` function with the appropriate environment variable, e.g.,
`env('XDG_CACHE_HOME')`.

### Constants

A number of constants are predefined:
Expand Down
Loading