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 dirs should default to $HOME #10

Closed
OJFord opened this issue Dec 21, 2021 · 2 comments
Closed

XDG user dirs should default to $HOME #10

OJFord opened this issue Dec 21, 2021 · 2 comments

Comments

@OJFord
Copy link

OJFord commented Dec 21, 2021

If ${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs does not exist, or lacks the specified key (e.g. XDG_DOWNLOAD_DIR), the behaviour of xdg-user-dir the CLI program is to output $HOME.

In the same case, the behaviour of dirs::download_dir() (for example) is to return None.

There's no specification as such for '"well known" user directories', but it's implied that this is the intended fall-back behaviour:

Note: To disable a directory, point it to the homedir.

https://www.freedesktop.org/wiki/Software/xdg-user-dirs/

cf. tauri-apps/tauri#3090, xdg-rs/dirs#56 (I opened there as that's what I'm using, via tauri, but it seems to affect dirs too, so I've copied here.)

@soc
Copy link
Collaborator

soc commented Jun 20, 2022

I don't read this sentence of the spec as a fallback behavior, but as a way to disable a directory ("To disable a directory, point it to the homedir.") as they seemingly have used "no entry" for other purposes already.

I believe this is correctly represented with None in Rust. Feel free to reopen if you have further thoughts on this!

@soc soc closed this as completed Jun 20, 2022
@OJFord
Copy link
Author

OJFord commented Jun 20, 2022

I suppose it depends whether you view the API as 'what has been configured?' (nothing, None) or 'what is the directory to use?' (not configured, $HOME or something sensible).

It'd be nice if these various libraries/tools were consistent on the matter, but having lost context on this I think you're right, it's at best ambiguous, and absent something explicit they never will be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants