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 139973 - API for implementing XDG base directory spec
API for implementing XDG base directory spec
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.5.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on: 139971
Blocks: 139974 148694
 
 
Reported: 2004-04-13 21:04 UTC by Ray Strode
Modified: 2011-02-18 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Provides functions for retrieving and searching the paths specified by the various $XDG_ enivornment variables (7.55 KB, patch)
2004-04-13 21:09 UTC, Ray Strode
none Details | Review
Updated patch (7.64 KB, patch)
2004-08-10 18:57 UTC, Ray Strode [halfline]
none Details | Review

Description Ray Strode 2004-04-13 21:04:12 UTC
It would be useful if glib provided an API for accessing and finding files in
the directories specified by the XDG base directory spec
(http://www.freedesktop.org/Standards/basedir-spec)
Comment 1 Ray Strode 2004-04-13 21:09:19 UTC
Created attachment 26634 [details] [review]
Provides functions for retrieving and searching the paths specified by the various $XDG_ enivornment variables

The above patch adds functions for getting and search the xdg base dirs.  Note
that it depends on the patch in bug 139971.
Comment 2 Matthias Clasen 2004-07-31 13:25:32 UTC
I think the find_file functions should take a callback and loop until it returns
true, instead of relying on file_test_full().
Comment 3 Owen Taylor 2004-08-02 21:30:56 UTC
Comments:

 - I think the getters should by G_CONST_RETURN and not return newly
   allocated strings. This requires some extra locking or extension
   of g_get_any_init() but having g_get_home_dir() and 
   g_get_user_data_dir() behave differently is asking for trouble.

   Doc comments should generally describe mememory management
   for string return values one way or the other.

 - As much as we don't abbreviate in general, I'd probably
   s/configuration/config/. (Some existing practice in GScannerConfig
   and GBSearchConfig)

 - Remember that GLib is a cross-platform library. So, the
   documentation should be phrased in more general terms. E.g.
   (not knowing what user_data_dir is for...)
   "Returns a directory in which to store application data
    such as icons that is customized for a particular user".

   Then you can include a link to the XDG basedir spec as what
   it does on Unix. But assuming that the reader knows what
   it is isn't that useful.

 - I don't really like the term "secondary". "system" strikes
   me as more related to the purpose. (Yes, it's settable by
   the  user via envvar, but logically its the part that isn't
   the user dirs)

 - I agree with Matthias that the GFileTest flags are probably
   not what we want. What's the the intended application usage of the
   find() functions? It seems to me that very frequently you
   want merging behavior not overriding behavior.
Comment 4 Matthias Clasen 2004-08-03 17:30:27 UTC
I think the find() functions are a bit questionable. Looking at the two possible
uses in GTK+, mime and icon themes, in both cases the acutal files to find are
in subdirectories of the xdg_data directories, so find() wouldn't have been
useful anyway. And then there is the question of merging instead of stopping at
the first one which owen mentioned. Both problems could be overcome with the
callback-based api which I proposed earlier, but maybe it is better to just add
the get_dir() functions for now.
Comment 5 Ray Strode [halfline] 2004-08-10 18:57:09 UTC
Created attachment 30408 [details] [review]
Updated patch

I've removed the find functions and updated things to match the above
suggestions.
Comment 6 Matthias Clasen 2004-08-10 19:19:09 UTC
Looks alright to me. Just misses the Since: 2.6 in the doc comments.