base dir spec question.

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 6 08:27:50 PDT 2010


(Cc'ing the author of the specification in question: Waldo, could you clarify
whether I'm interpreting it correctly?)

At the beginning of this thread, Sander Jansen <s.jansen at gmail.com> wrote:
> For my music manager I need to store a sqlite3 database file somewhere
> on disk. Which directory would be the most appropriate to use, the
> XDG_CONFIG_HOME or the XDG_DATA_HOME directory?

On Thu, 06 May 2010 at 09:28:42 -0500, Sander Jansen wrote:
> The database is really
> a hybrid between config and data, so I think I agree that a local /var
> would be the best fit. I think I'm going to stick with XDG_CONFIG_HOME
> for now.

I'm pretty sure this isn't configuration (preferences). Deleting preferences
is meant to return the app to an unconfigured state, but not destroy
user-entered data like this:

On Thu, 06 May 2010 at 09:28:42 -0500, Sander Jansen wrote:
> In addition, users
> may change the data in the database without writing it back to the tag
> as well.

so I'd put it in XDG_DATA_HOME, as Julien Danjou suggested.

There seems to be some disagreement over what XDG_DATA_xxx is for, and
in particular whether it's "like /usr/share", "like /var/lib", or something
else entirely.

My personal impression is it's a combination of "like /usr/share" and
"like /var/lib" - the system-wide part is in /usr/share because it isn't
edited, even by the system administrator, but the part in a user-specific
directory can be changed by that user.

The basedir document itself describes XDG_DATA_HOME as "a single base directory
relative to which user-specific data files should be written". I think
that sounds like a suitable place for databases...

GNOME's interpretation of the XDG_foo directories is at
<http://live.gnome.org/GnomeGoals/XDGConfigFolders>. It references
<http://ploum.frimouvy.org/?207-modify-your-application-to-use-xdg-folders>,
which focuses on defining what preferences and cache are, then considers
everything else that's not an explicitly-saved document to be "data".

KDE's interpretation is
<http://techbase.kde.org/KDE_System_Administration/XDG_Filesystem_Hierarchy>,
which says
> Data that applications store which are specific to a given user are
> to be stored in the XDG_DATA_HOME directory
[...]
> Configuration information should be stored in the XDG_CONFIG_HOME directory

The freedesktop.org trash specification (which sounds like a user-specific
part of /var to me...) uses XDG_DATA_HOME, too.

Regards,
    Simon


More information about the xdg mailing list