Skip to content

Commit

Permalink
Update readme to reflect actual behavior of user directory functions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Dec 20, 2024
1 parent 20192d4 commit 76362bf
Showing 1 changed file with 16 additions and 6 deletions.
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

0 comments on commit 76362bf

Please sign in to comment.