From 4a2ab37162ba605698fed79bbc2ee5e9ac5b3d62 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 2 Dec 2011 22:00:05 +0000 Subject: [PATCH] [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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21656 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/core-utils/gnc-path.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/core-utils/gnc-path.c b/src/core-utils/gnc-path.c index 411d8a37ff..888b92eaf0 100644 --- a/src/core-utils/gnc-path.c +++ b/src/core-utils/gnc-path.c @@ -154,10 +154,19 @@ gchar *gnc_path_get_accountsdir() * @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; } @@ -169,8 +178,17 @@ gchar *gnc_path_get_reportdir() * @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;