.gnucash and GNC_DOT_DIR

John Ralls jralls at ceridwen.us
Thu Feb 4 19:53:59 EST 2010

Motivated by a recent issue in gnucash-users, where a MacOSX user had trouble because .gnucash is invisible to TextEdit (which normal users would use to edit a file), and because it's actually necessary to edit .gnucash/saved-reports-2.0 to clean old reports from the menu, I decided that for OSX the Gnucash prefs should live in the more Macish ~/Library/Application Support/Gnucash. So far, so good.

Src/engine/gnc-filepath-utils.c has two ways to find the preferences directory: A public one, gnc_dot_gnucash_dir(), and a private one hard coded in xaccResolveFilePath() and some static functions which it uses. The former uses glib tools and provides an undocumented (at least as far as I can find) environment variable $GNC_DOT_DIR to easily override the directory (my goal). The latter has ~/.gnucash hardcoded along with some other inappropriate hard-coded paths and a rather bizarre indirection scheme for resolving filenames.

The attached patch replaces the private static functions in xaccResolveFilePath() with calls to gnc_dot_gnucash_dir() and (I think) rationalizes the filename resolution using functions graciously provided in gnc-path.h. 

Before I commit it, I'd like some of the devs more experienced with GC to look it over and make sure I haven't done something overly stupid. It would probably be a good idea for one of the MSWin maintainers to make sure that it doesn't break anything there.

John Ralls
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot_gnucash.patch
Type: application/octet-stream
Size: 9888 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20100204/09a58aeb/attachment.obj>

More information about the gnucash-devel mailing list