~/.gnucash and XDG default directories
Geert Janssens
janssens-geert at telenet.be
Sun Jan 16 10:19:41 EST 2011
Historically, GnuCash has always stored its user specific application data in
~/.gnucash based on old linux (unix ?) conventions.
This didn't work really well on Mac OS X/Quartz, so John has overridden this
path on OS X to make more sense there.
Now there's a bugreport that indicates this isn't the best place on Windows
either [1].
I could override the path on Windows as well and be done with it, but in my
investigation I found that even on linux ~/.<appname> is no longer the
recommended place to store such information.
According to the XDG Base Directory Specification [2] the preferred location
is ~/.local/share/<appname>.
The nice thing is, glib has a convenience function g_get_user_config_dir,
which by default returns ~/.local/share on linux and the equivalent and proper
~\Application Data (Windows XP) or ~\AppData\Roaming (Windows Vista/7).
I don't know what this routine returns on OS X, but I would expect it to
return the proper location for user specific application data there as well.
If not that should be reported as a bug againse glib on OS X.
In this light I would like to update the GnuCash code to make use of the
g_get_user_data_dir function on all platforms and rename the directory from
.gnucash to gnucash. That would give a better experience on all platforms IMO.
This is what the directories would become:
- Linux: ~/.local/share/gnucash
- Windows XP: c:\Documents and Settings\<user>\Application Data\gnucash
- Windows Vista/7: c:\Documents and Settings\<user>\AppData\Roaming\gnucash
- OS X: ?
I would obviously have to provide some conversion code as well, that would
copy the old .gnucash contents to .local/share/gnucash to guarantee continuity
for the users.
I also think this change may be better for 2.5/2.6 than 2.4.1.
Does anyone have any objections to this ?
Geert
[1] see https://bugzilla.gnome.org/show_bug.cgi?id=503722
[2] see http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
More information about the gnucash-devel
mailing list