rust-xdg
rust-xdg copied to clipboard
Wishlist: support other dirs (xdg-user-dirs, trash, etc)
One of the things I never got around to adding support for was xdg-user-dirs - things like ~/Documents
, ~/Music
, etc.
This is more complicated because it involves reading the config from files instead of just the environment, and translating according to the current locale. Also xdg-user-dirs is not a spec, just a set of tools.
Trash is a spec though.
There is no $(XDG_CONFIG_HOME)/user-dirs.dirs
on my system, so it seems modern DEs don't care for running that tool.
~/.config/user-dirs.dirs
exists for me, do you have /etc/xdg/user-dirs.{conf,defaults}
at least?
Nope.
Do you have any further suggestions on this topic?
I have no clue, I'm honestly surprised that any desktop system does not have it.
Ah, there's this... https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599391
I have this file (~/.config/user-dirs.dirs
):
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
Sure. What I'm saying is that KDE, at least on my system, doesn't write that file, and in fact doesn't even depend on whatever package xdg-user-dirs-update
is in.
I have no objections to inclusion of a parser for this in the xdg crate, I just express my doubt about the usefulness of it.
Although the fact that there's no specification is also troublesome... @o11c mentioned something about locale, where do I even get that information?
I don't know, I don't need this feature, just wanted to provide information. Locale might come from this file:
$ hexdump -C ~/.config/user-dirs.locale
00000000 43 |C|
00000001
I started working on implementing xdg-user-dirs
, and I plan on implementing the Trash spec and possibly others as well.