After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 555715 - support dynamic xdg directories
support dynamic xdg directories
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-10-09 18:26 UTC by Nicolò Chieffo
Modified: 2010-07-10 23:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nicolò Chieffo 2008-10-09 18:26:33 UTC
Currently xdg dirs are static, you have to logout if you change one of them.
this is a limitation because they could be dynamic.

this could be done simply in two ways
1) 2 functions:
    - g_set_user_special_dir
    - g_invalidate_user_special_dir_cache

2) a patch to the current g_get_user_special_dir so that it re-loads the user dirs when a directory is not found (this adds IO but it's transparent).
see this patch http://bugzilla.gnome.org/attachment.cgi?id=120296
Comment 1 Matthias Clasen 2008-10-10 01:49:53 UTC
I've already explained in bug 541276 why the api doesn't really allow for changes in the user special dirs - this is the same for all the other statically allocated data we provide, like home dirs, user name, etc 

"this is a limitation because they could be dynamic" is hardly a good explanation for why this would be important to fix. 

There are important shortcomings in GLib, but this is not one of them...
Comment 2 Christian Dywan 2009-04-24 11:51:21 UTC
Trying to make any of the g_get_user_foo and friends "dynamic" is bound to be ugly, because these functions are just not designed for this. There is no way to notice if the directory changed either.

I wonder, what about solving this with a special GFile, such as g_file_new_for_special_user_dir? I'm not sure if a subclass is needed but a GFile can easily be monitored and always returns a newly allocated string.
Comment 3 Matthias Clasen 2010-07-10 23:39:39 UTC
We have meanwhile added g_reload_user_special_dirs_cache(), which is about as much as we can do here.