Moving .gnucash and friends from $HOME to XDG_DATA_HOME (and impact on other applications like KMyMoney)
jralls at ceridwen.fremont.ca.us
Wed Aug 23 17:21:23 EDT 2017
> On Aug 23, 2017, at 6:09 PM, Geert Janssens <geert.gnucash at kobaltwit.be> wrote:
> I have started the work to fix https://bugzilla.gnome.org/show_bug.cgi?
> id=503722 (Do not store data in Vista's HOME folder, use AppData instead)
> Handling .gnucash itself was relatively straightforward and the result can be
> tested on my private github repo's master branch. The only thing missing in
> this part is informing the user this migration happened.
> Aside from .gnucash using gnucash can also generate a directory named
> .aqbanking, which ideally would be moved out of the way as well.
> The good news is aqbanking allows a custom setting for this directory, to be
> passed either when creating an AQBanking object in code or via the
> AQBANKING_HOME environment variable. So there is no technical issue here.
> What makes it more complicated though is that aqbanking is a shared library
> which can be used by several applications. A quick search in the standard
> Fedora repositories shows at least KMyMoney uses this as well and probably
> shares its aqbanking settings with gnucash. So if I move the settings to say
> XDG_DATA_HOME/AqBanking, subsequent changes to the aqbanking settings in
> either application won't be picked up by the other any more.
> This is not too nice to the users of either application. So I wonder what
> would be the best course of action.
> Probably the most elegant way would be to (hard/soft)link $HOME/.aqbanking to
> XDG_DATA_HOME/AqBanking and inform the user $HOME/.aqbanking can be removed if
> s/he is not using any other applications depending on it (mentioning
> KMyMoney). I know both windows and linux support some form of hardlinking
> (though they are called differently). However I don't know if
> boost::filesystem will support it on both platforms.
> Linking has its drawbacks as well though. If I link the directory, the files
> and subdirectories will be essentially the same. However if the user
> misinterprets the message and removes file by file from $HOME/.gnucash instead
> of the directory link, the files are still lost.
> On the other hand if I only link the files inside, new files will not be seen
> by both applications.
> The other option is to leave it up to the user and only copy the directory
> followed by a message explaining gnucash now uses another directory to store
> these settings. If other applications are also using it, please take steps to
> ensure you synchronize this info.
> If any of the KMyMoney developers is on the list, I'd be very interested in
> discussing a solution that would work well for both applications. If I don't
> hear from them on this list I'll probably take it up on their communication
> channels as well.
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.
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.
 https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html <https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>
More information about the gnucash-devel