Moving .gnucash and friends from $HOME to XDG_DATA_HOME (and impact on other applications like KMyMoney)

Geert Janssens geert.gnucash at
Wed Aug 23 13:09:04 EDT 2017

I have started the work to fix
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.



More information about the gnucash-devel mailing list