Moving .gnucash and friends from $HOME to XDG_DATA_HOME (and impact on other applications like KMyMoney)
Geert Janssens
geert.gnucash at kobaltwit.be
Thu Aug 24 03:57:07 EDT 2017
On woensdag 23 augustus 2017 23:21:23 CEST John Ralls wrote:
> A new default should apply only to new installations and should be
> overridden by $GNC_DOT_DIR and $AQBANKING_HOME; we should continue to
> include ~/.gnucash and ~/.aqbanking in the default search and use the first
> instance of the config file we find.
>
While that is conservative and safe, it would also require us to support the
outdated directories forever and by extension make our code more complicated
for that same period. So I'm not in favor of this strategy.
And I'm not the only one. I have come across several applications in my long
use of linux that have chosen not to do that either. Two come to mind
immediately: libreoffice has changed user data directories with every major
release for as long as I have used it. It has always copied the old one and
didn't even bother telling the user about this. KMail did a similar migration
twice, and informed the me about it on each occasion.
So I think to point of view to take here is gnucash 2.8 is a new application
that knows how to import settings from an older application (which happens to
be gnucash 2.6 or older). At some point in the future nobody will still be
using the old application at which point the user can decide to drop the
configuration that old app used (I think nobody does that in real life
though).
I agree an override option should exist indeed. Not in the least because
you're using it on OS X :)
On the other hand I think GNC_DOT_DIR is tied way too much to the old
directory format and I prefer to change it to GNC_DATA_HOME (as GNC_HOME is
already in use to point at the base installation directory).
> The XDG environment variables are appropriate in the Gnome and KDE desktop
> environments on Linux and pretty much nowhere else. Perhaps the best
> approach would be to set reasonable defaults per OS and allow them to be
> overridden with a CMake variable and configure argument.
>
The per OS defaults are a good suggestion. On linux and compatible that is
XDG_DATA_HOME/Gnucash, on Windows CSIDL_APPDATA\Gnucash. I'm only missing this
on OS X. Is there a function in the Quarz framework that would return ~/
Library/Application Support/ so a similar default path can be created ? I'd
want the defaults to be such that no environment variable should be set to get
them.
About the override in Cmake or configure, I doubt that makes much sense. These
directories have no use during build, only at runtime*. And at runtime they
can be overridden by GNC_DATA_HOME and AQBANKING_HOME.
Geert
* Strictly speaking I should say "should have no use during build".
Unfortunately compiling the guile sources will cause the user_data_dir
functions to be run. It's guile's way of evaluating whether dynamically loaded
modules won't call other guile sources that need to be compiled :(
I'm still evaluating whether this is bad for my new code or not.
More information about the gnucash-devel
mailing list