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

XDG user directories (e.g. path.downloadDir) are not env vars [docs] #3090

Closed
OJFord opened this issue Dec 21, 2021 · 1 comment · Fixed by #3092
Closed

XDG user directories (e.g. path.downloadDir) are not env vars [docs] #3090

OJFord opened this issue Dec 21, 2021 · 1 comment · Fixed by #3092
Labels
type: documentation Need to update the API documentation

Comments

@OJFord
Copy link
Contributor

OJFord commented Dec 21, 2021

The documentation suggests path.downloadDir, for example, will read the value of an environment variable named XDG_DOWNLOAD_DIR.

Unfortunately IMO, this is not a (standard) env var, and not read by either dirs-next or the xdg-user-dirs program.

Instead, ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dir (containing export-format like list of these settings) is parsed.

(Aside: and a bug IMO, dirs-next does not provide defaults. So path.downloadDir fails if user-dirs.dir does not exist, or does not contain a value for XDG_DOWNLOAD_DIR. Simplest fix for tauri (distribution packages) is to consider xdg-user-dirs a dependency, and ensure xdg-user-dirs-update has been run, which will generate defaults.)

PR to follow.

@OJFord OJFord added the type: documentation Need to update the API documentation label Dec 21, 2021
@OJFord
Copy link
Contributor Author

OJFord commented Dec 21, 2021

Simplest fix for tauri (distribution packages) is to consider xdg-user-dirs a dependency, and ensure xdg-user-dirs-update has been run, which will generate defaults.)

Although of course that isn't really a fix, since it's a run-time problem.

OJFord added a commit to OJFord/tauri that referenced this issue Dec 21, 2021
This commit points the docs on `path.downloadDir` for XDG_DOWNLOAD_DIR
on Linux, and similar XDG user dirs, at the `xdg-user-dirs` program for
more information, and fixes that they currently imply these are
environment variables; which they a) are unfortunately not by any sort
of standard; b) such env vars are ignored by `dirs-next` which tauri
uses for resolving them.

This does not address the issue of
`${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dir` needing to already
exist and contain the appropriate key for this to work (i.e. they do not
default to `$HOME` as the output of `xdg-user-dir` does) - because that
IMO is a shortcoming of `dirs-next` and is better addressed there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation Need to update the API documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant