r19505 - gnucash/trunk/src - Calculate standard-reports dir internally instead of reading it from the environment.
Geert Janssens
gjanssens at code.gnucash.org
Sun Aug 29 15:02:57 EDT 2010
Author: gjanssens
Date: 2010-08-29 15:02:57 -0400 (Sun, 29 Aug 2010)
New Revision: 19505
Trac: http://svn.gnucash.org/trac/changeset/19505
Modified:
gnucash/trunk/src/bin/Makefile.am
gnucash/trunk/src/bin/environment.in
gnucash/trunk/src/core-utils/core-utils.i
gnucash/trunk/src/core-utils/core-utils.scm
gnucash/trunk/src/core-utils/gnc-path.c
gnucash/trunk/src/core-utils/gnc-path.h
gnucash/trunk/src/report/standard-reports/standard-reports.scm
Log:
Calculate standard-reports dir internally instead of reading it from the environment.
This is a step to make gnucash more run-time relocatable.
Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/bin/Makefile.am 2010-08-29 19:02:57 UTC (rev 19505)
@@ -101,7 +101,6 @@
sed < $< > $@.tmp \
-e 's#@-BIN_DIR-@#${bindir}#g' \
-e 's#@-GNC_DBD_DIR-@#${GNC_DBD_DIR}#g' \
- -e 's#@-GNC_STANDARD_REPORTS_DIR-@#${GNC_SHAREDIR}/guile-modules/gnucash/report/standard-reports#g' \
-e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
@@ -116,7 +115,6 @@
rm -f $@.tmp
sed < $< > $@.tmp \
-e 's#@-BIN_DIR-@#${bindir}#g' \
- -e 's#@-GNC_STANDARD_REPORTS_DIR-@#${GNC_SHAREDIR}/guile-modules/gnucash/report/standard-reports#g' \
-e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
Modified: gnucash/trunk/src/bin/environment.in
===================================================================
--- gnucash/trunk/src/bin/environment.in 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/bin/environment.in 2010-08-29 19:02:57 UTC (rev 19505)
@@ -22,5 +22,3 @@
EXTRA_LIBS={GNC_MODULE_PATH};@-GNC_LIB_INSTALLDIR-@;@-GNC_PKGLIB_INSTALLDIR-@
LD_LIBRARY_PATH={EXTRA_LIBS};{LD_LIBRARY_PATH}
DYLD_LIBRARY_PATH={EXTRA_LIBS};{DYLD_LIBRARY_PATH}
-
-GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@
Modified: gnucash/trunk/src/core-utils/core-utils.i
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.i 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/core-utils/core-utils.i 2010-08-29 19:02:57 UTC (rev 19505)
@@ -3,6 +3,7 @@
#include <guile-mappings.h>
#include <gnc-glib-utils.h>
#include <gnc-main.h>
+#include <gnc-path.h>
#include <glib.h>
SCM scm_init_sw_core_utils_module (void);
@@ -15,6 +16,8 @@
gboolean gnc_is_debugging(void);
+gchar * gnc_path_get_stdreportsdir(void);
+
void gnc_scm_log_warn(const gchar *);
void gnc_scm_log_error(const gchar *);
void gnc_scm_log_msg(const gchar *);
Modified: gnucash/trunk/src/core-utils/core-utils.scm
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.scm 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/core-utils/core-utils.scm 2010-08-29 19:02:57 UTC (rev 19505)
@@ -10,6 +10,7 @@
(use-modules (sw_core_utils))
(re-export gnc-is-debugging)
+(re-export gnc-path-get-stdreportsdir)
(re-export g-find-program-in-path)
(re-export gnc-utf8?)
(re-export gnc-utf8-strip-invalid-strdup)
Modified: gnucash/trunk/src/core-utils/gnc-path.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-path.c 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/core-utils/gnc-path.c 2010-08-29 19:02:57 UTC (rev 19505)
@@ -112,7 +112,7 @@
return result;
}
-/** Returns the glade file path, usually
+/** Returns the accounts file path, usually
* "$prefix/share/gnucash/accounts".
*
* @returns A newly allocated string. */
@@ -125,6 +125,21 @@
return result;
}
+/** Returns the file path to the standard
+ * reports, usually
+ * "$prefix/share/gnucash/guile-modules/gnucash/report/standard-reports".
+ *
+ * @returns A newly allocated string. */
+gchar *gnc_path_get_stdreportsdir()
+{
+ gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
+ gchar *result = g_build_filename (pkgdatadir, "guile-modules",
+ "gnucash", "report", "standard-reports", (char*)NULL);
+ g_free (pkgdatadir);
+ //printf("Returning stdreportsdir %s\n", result);
+ return result;
+}
+
/** Returns the gconf schema config source path, usually
* "$prefix/etc/gconf/gconf.xml.defaults".
*
Modified: gnucash/trunk/src/core-utils/gnc-path.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-path.h 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/core-utils/gnc-path.h 2010-08-29 19:02:57 UTC (rev 19505)
@@ -68,12 +68,19 @@
* @returns A newly allocated string. */
gchar *gnc_path_get_localedir(void);
-/** Returns the glade file path, usually
+/** Returns the accounts file path, usually
* "$prefix/share/gnucash/accounts".
*
* @returns A newly allocated string. */
gchar *gnc_path_get_accountsdir(void);
+/** Returns the file path to the standard
+ * reports, usually
+ * "$prefix/share/gnucash/guile-modules/gnucash/report/standard-reports".
+ *
+ * @returns A newly allocated string. */
+gchar *gnc_path_get_stdreportsdir(void);
+
/** Returns the gconf schema config source path, usually
* "$prefix/etc/gconf/gconf.xml.defaults".
*
Modified: gnucash/trunk/src/report/standard-reports/standard-reports.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/standard-reports.scm 2010-08-29 18:57:13 UTC (rev 19504)
+++ gnucash/trunk/src/report/standard-reports/standard-reports.scm 2010-08-29 19:02:57 UTC (rev 19505)
@@ -9,6 +9,7 @@
(use-modules (ice-9 slib))
(use-modules (srfi srfi-13))
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash core-utils))
(export gnc:register-report-create)
(export gnc:register-report-hook)
@@ -110,18 +111,18 @@
)
)
-;; Return a list of symbols representing reports in the GNC_STANDARD_REPORTS_DIR directory
+;; Return a list of symbols representing reports in the standard reports directory
;;
;; Return value:
;; List of symbols for reports
(define (get-report-list)
(map (lambda (s) (string->symbol s))
- (process-file-list (directory-files (getenv "GNC_STANDARD_REPORTS_DIR")))
+ (process-file-list (directory-files (gnc-path-get-stdreportsdir)))
)
)
-(gnc:debug "dir-files=" (directory-files (getenv "GNC_STANDARD_REPORTS_DIR")))
-(gnc:debug "processed=" (process-file-list (directory-files (getenv "GNC_STANDARD_REPORTS_DIR"))))
+(gnc:debug "dir-files=" (directory-files (gnc-path-get-stdreportsdir)))
+(gnc:debug "processed=" (process-file-list (directory-files (gnc-path-get-stdreportsdir))))
(gnc:debug "report-list=" (get-report-list))
(for-each
More information about the gnucash-changes
mailing list