[PATCH] Allow override of the dotfile location
Derek Atkins
warlord at MIT.EDU
Wed Mar 21 04:53:41 EDT 2007
Why not just run:
HOME=... gnucash
??? Or does this no longer work now that we've changed to
g_get_home_dir()?
-derek
James Radley <james at hiltonbury.com> writes:
> The attached patch allows you to override the '.gnucash' directory.
> Currently, this always defaults to ${HOME}/.gnucash which is a problem
> if you are developing GNC, and don't want to impact the existing stable
> GNC2.0.x installation that I'm using for my real accounts.
>
> Essentially, setting the "GNC_DOT_DIR" environment variable will cause
> the dotdir and it's associated files to sit in ${GNC_DOT_DIR}. If the
> variable is not set, the old behaviour is used.
>
> James
>
>
>
>
> Index: src/engine/gnc-filepath-utils.c
> ===================================================================
> --- src/engine/gnc-filepath-utils.c (revision 15738)
> +++ src/engine/gnc-filepath-utils.c (working copy)
> @@ -382,14 +382,17 @@
> if (dotgnucash)
> return dotgnucash;
>
> - home = g_get_home_dir();
> - if (!home) {
> - g_warning("Cannot find home directory. Using tmp directory instead.");
> - home = g_get_tmp_dir();
> + dotgnucash = getenv("GNC_DOT_DIR");
> + if(!dotgnucash) {
> + home = g_get_home_dir();
> + if (!home) {
> + g_warning("Cannot find home directory. Using tmp directory instead.");
> + home = g_get_tmp_dir();
> + }
> + g_assert(home);
> +
> + dotgnucash = g_build_filename(home, ".gnucash", (gchar *)NULL);
> }
> - g_assert(home);
> -
> - dotgnucash = g_build_filename(home, ".gnucash", (gchar *)NULL);
> gnc_validate_directory(dotgnucash);
>
> /* Since we're in code that is only executed once.... */
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-devel
mailing list