r15746 - gnucash/trunk/src/engine - Patch from James Radley to allow override of the dotfile location.

Andreas Köhler andi5 at cvs.gnucash.org
Wed Mar 21 18:50:13 EDT 2007


Author: andi5
Date: 2007-03-21 18:50:12 -0400 (Wed, 21 Mar 2007)
New Revision: 15746
Trac: http://svn.gnucash.org/trac/changeset/15746

Modified:
   gnucash/trunk/src/engine/gnc-filepath-utils.c
Log:
Patch from James Radley to allow override of the dotfile location.

Read environment variable GNC_DOT_DIR and, if available, use this
instead of `g_get_home_dir`/.gnucash.  This allows one develop without
impacting an existing stable installation, excepting shared GConf
keys.  Setting HOME does not help, because g_get_home_dir prefers
passwd entries.


Modified: gnucash/trunk/src/engine/gnc-filepath-utils.c
===================================================================
--- gnucash/trunk/src/engine/gnc-filepath-utils.c	2007-03-21 20:03:47 UTC (rev 15745)
+++ gnucash/trunk/src/engine/gnc-filepath-utils.c	2007-03-21 22:50:12 UTC (rev 15746)
@@ -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 = g_strdup(g_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.... */



More information about the gnucash-changes mailing list