~/.gnucash and XDG default directories
Geert Janssens
janssens-geert at telenet.be
Sun Jan 16 11:41:45 EST 2011
On Sunday 16 January 2011, John Ralls wrote:
> On Jan 16, 2011, at 7:19 AM, Geert Janssens wrote:
> > 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 ?
>
> You must have $XDG_CONFIG_HOME set on your Linux system. If that's not set,
> then g_get_user_config_dir returns $HOME/.config., which if everyone used
> it would be an improvement over littering $HOME with hidden directories.
Oops, I mixed those up yes. g_get_user_config_dir defaults to $HOME/.config,
g_get_user_data_dir defaults to $HOME/.local/share.
The problem with the latter is that g_get_user_data_dir on Windows is equal to
g_get_home_dir. So using that on Windows just doesn't change anything to what
we have now.
> Not everybody uses it, though. In fact, on my Debian Lenny VM,
> ~/.local/share contains one subdirectory, "Trash", and ~/.config contains
> two, "gtk+-2.0" and "enchant". AQBanking and GConf each have their own
> hidden directories. Admittedly, I have that VM set up with KDE, and I use
> it only for development so there aren't a lot of applications on it.
>
On my systems (currently Fedora 13 and 14) which I use as primary desktops,
both .config and .local/share hold data for 10-30 applications. Some are KDE
some are Gnome. I also know Gnome has made it a GnomeGoal to have all of its
applications use these directories. So at least for Gnome, this seems to be
the way to go in the future.
> I think it makes more sense to lift get_special_folder(int) from
> glib/gutils.c, use that to set the directory on win32, and to leave the
> rest alone... but the change is mostly harmless (you'll need to look for
> ~/.gnucash and copy it over, and maybe ask the user if she wants to delete
> the old location), so if you really want to do it I have no objections.
> I'll just change GNC_DOT_DIR to XDG_CONFIG_HOME in the OSX launcher
> script.
>
I presume you mean to make this change after I have made the changes to use
g_get_user_config_dir ?
Geert
More information about the gnucash-devel
mailing list