r21697 - gnucash/branches/2.4/src/core-utils - [r21656][Testing] Provide for gnc_path_get_reportdir() and gnc_path_get_stdreportsdir() to return build-directory paths
John Ralls
jralls at code.gnucash.org
Fri Dec 9 18:11:10 EST 2011
Author: jralls
Date: 2011-12-09 18:11:09 -0500 (Fri, 09 Dec 2011)
New Revision: 21697
Trac: http://svn.gnucash.org/trac/changeset/21697
Modified:
gnucash/branches/2.4/src/core-utils/gnc-path.c
Log:
[r21656][Testing] Provide for gnc_path_get_reportdir() and gnc_path_get_stdreportsdir() to return build-directory paths
As with engine, in response to environment variables GNC_UNINSTALLED and GNC_BUILDDIR.
GNC_UNINSTALLED is intended to be set via g_setenv() or (setenv) at the beginning of a test program. GNC_BUILDDIR is intended to be set with
GNC_BUILDDIR=`cd ${top_builddir} && pwd`
as part of the TESTS_ENVIRONMENT variable in test Makefiles.
Modified: gnucash/branches/2.4/src/core-utils/gnc-path.c
===================================================================
--- gnucash/branches/2.4/src/core-utils/gnc-path.c 2011-12-09 23:10:58 UTC (rev 21696)
+++ gnucash/branches/2.4/src/core-utils/gnc-path.c 2011-12-09 23:11:09 UTC (rev 21697)
@@ -141,10 +141,19 @@
* @returns A newly allocated string. */
gchar *gnc_path_get_reportdir()
{
- gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
- gchar *result = g_build_filename (pkgdatadir, "guile-modules",
+ gchar *result;
+ const gchar *builddir = g_getenv ("GNC_BUILDDIR");
+ if (g_getenv ("GNC_UNINSTALLED") && builddir)
+ {
+ result = g_build_filename (builddir, "src", "report", NULL);
+ }
+ else
+ {
+ gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
+ result = g_build_filename (pkgdatadir, "guile-modules",
"gnucash", "report", (char*)NULL);
- g_free (pkgdatadir);
+ g_free (pkgdatadir);
+ }
//printf("Returning stdreportsdir %s\n", result);
return result;
}
@@ -156,8 +165,17 @@
* @returns A newly allocated string. */
gchar *gnc_path_get_stdreportsdir()
{
+ gchar *result;
gchar *reportdir = gnc_path_get_reportdir ();
- gchar *result = g_build_filename (reportdir, "standard-reports", (char*)NULL);
+ if (g_getenv ("GNC_UNINSTALLED"))
+ {
+ result = g_build_filename (reportdir, "standard-reports", "gnucash",
+ "report", "standard-reports", NULL);
+ }
+ else
+ {
+ result = g_build_filename (reportdir, "standard-reports", NULL);
+ }
g_free (reportdir);
//printf("Returning stdreportsdir %s\n", result);
return result;
More information about the gnucash-changes
mailing list