[PATCH] Allow override of the dotfile location

James Radley james at hiltonbury.com
Wed Mar 21 17:22:50 EDT 2007


Hmm. After a quick read of the glib docs, I'd agree with you about the 
$HOME variable, which is a fallback if glib can't work out the home 
directory from /etc/passwd or similar. I've amended the patch slightly 
below, to use g_getenv() as you suggest, and to g_strdup() the result 
before assigning to dotgnucash. This should have the double effect of

a) Having a string that's safe to g_free() -- though I'm not sure it 
will be, as dotgnucash is a static variable. Better to be safe though.
b) Having a string that won't mutate next time someone calls 
g_[get|set|unset]env()

James

Christian Stimming wrote:
> Am Mittwoch, 21. März 2007 09:53 schrieb Derek Atkins:
>   
>> Why not just run:
>>
>>   HOME=... gnucash
>>
>> ???   Or does this no longer work now that we've changed to
>> g_get_home_dir()?
>>     
>
> According to the documentation of g_get_home_dir, this does *not* work any 
> longer. I think this is a good extension.
>
> @James: The patch looks fine, except that you should use g_getenv instead of 
> getenv (and IIRC there were some reversed semantics when changing from one 
> such call to the other). Also, the result of g_build_filename is owned by the 
> caller and will be freed later, and I'm not so sure whether this is correct 
> for a string that was retrieved from getenv/g_getenv.
>
> Thanks for the contribution in any case,
>
> Christian
>
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gnc_patch2
Url: http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20070321/0692c7ef/attachment.pl 


More information about the gnucash-devel mailing list