By example,
In English the default user folders will be:
$HOME/Desktop
....
$HOME/Videos
In Spanish the default user folders will be:
$HOME/Escritorio
....
$HOME/VĂdeos
The file ~/.config/user-dirs.dirs
has those localize names for the default folders. (Always?).
I need to get those names from a python script. I'd like not to parse that file. Is there other elegant way?
I found this:
from xdg.BaseDirectory import *
print xdg_cache_home
print xdg_config_dirs
print xdg_config_home
print xdg_data_dirs
print xdg_data_home
But it doesn't return those folders.
Thanks in advance!
Best Answer
If you don't mind getting a dependency on
GLib
or if you're already usingGTK
as toolkit, you can use theGLib.get_user_special_dir()
method.All available directories:
If you get this error message:
You need to use this: