Calculate standard-reports dir internally instead of reading it from the environment.

This is a step to make gnucash more run-time relocatable.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19505 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens
2010-08-29 19:02:57 +00:00
parent 9b556b6392
commit c741b07352
7 changed files with 33 additions and 10 deletions

View File

@@ -101,7 +101,6 @@ gnucash-setup-env: gnucash-setup-env-osx.in ${top_builddir}/config.status Makefi
sed < $< > $@.tmp \ sed < $< > $@.tmp \
-e 's#@-BIN_DIR-@#${bindir}#g' \ -e 's#@-BIN_DIR-@#${bindir}#g' \
-e 's#@-GNC_DBD_DIR-@#${GNC_DBD_DIR}#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_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \ -e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \ -e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
@@ -116,7 +115,6 @@ environment: ${GNUCASH_ENVIRONMENT}.in ${top_builddir}/config.status Makefile
rm -f $@.tmp rm -f $@.tmp
sed < $< > $@.tmp \ sed < $< > $@.tmp \
-e 's#@-BIN_DIR-@#${bindir}#g' \ -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_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \ -e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \ -e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \

View File

@@ -22,5 +22,3 @@ GUILE_LOAD_PATH={EXTRA_PATH};{GUILE_LOAD_PATH}
EXTRA_LIBS={GNC_MODULE_PATH};@-GNC_LIB_INSTALLDIR-@;@-GNC_PKGLIB_INSTALLDIR-@ EXTRA_LIBS={GNC_MODULE_PATH};@-GNC_LIB_INSTALLDIR-@;@-GNC_PKGLIB_INSTALLDIR-@
LD_LIBRARY_PATH={EXTRA_LIBS};{LD_LIBRARY_PATH} LD_LIBRARY_PATH={EXTRA_LIBS};{LD_LIBRARY_PATH}
DYLD_LIBRARY_PATH={EXTRA_LIBS};{DYLD_LIBRARY_PATH} DYLD_LIBRARY_PATH={EXTRA_LIBS};{DYLD_LIBRARY_PATH}
GNC_STANDARD_REPORTS_DIR=@-GNC_STANDARD_REPORTS_DIR-@

View File

@@ -3,6 +3,7 @@
#include <guile-mappings.h> #include <guile-mappings.h>
#include <gnc-glib-utils.h> #include <gnc-glib-utils.h>
#include <gnc-main.h> #include <gnc-main.h>
#include <gnc-path.h>
#include <glib.h> #include <glib.h>
SCM scm_init_sw_core_utils_module (void); SCM scm_init_sw_core_utils_module (void);
@@ -15,6 +16,8 @@ gchar * g_find_program_in_path(const gchar *);
gboolean gnc_is_debugging(void); gboolean gnc_is_debugging(void);
gchar * gnc_path_get_stdreportsdir(void);
void gnc_scm_log_warn(const gchar *); void gnc_scm_log_warn(const gchar *);
void gnc_scm_log_error(const gchar *); void gnc_scm_log_error(const gchar *);
void gnc_scm_log_msg(const gchar *); void gnc_scm_log_msg(const gchar *);

View File

@@ -10,6 +10,7 @@
(use-modules (sw_core_utils)) (use-modules (sw_core_utils))
(re-export gnc-is-debugging) (re-export gnc-is-debugging)
(re-export gnc-path-get-stdreportsdir)
(re-export g-find-program-in-path) (re-export g-find-program-in-path)
(re-export gnc-utf8?) (re-export gnc-utf8?)
(re-export gnc-utf8-strip-invalid-strdup) (re-export gnc-utf8-strip-invalid-strdup)

View File

@@ -112,7 +112,7 @@ gchar *gnc_path_get_localedir()
return result; return result;
} }
/** Returns the glade file path, usually /** Returns the accounts file path, usually
* "$prefix/share/gnucash/accounts". * "$prefix/share/gnucash/accounts".
* *
* @returns A newly allocated string. */ * @returns A newly allocated string. */
@@ -125,6 +125,21 @@ gchar *gnc_path_get_accountsdir()
return result; 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 /** Returns the gconf schema config source path, usually
* "$prefix/etc/gconf/gconf.xml.defaults". * "$prefix/etc/gconf/gconf.xml.defaults".
* *

View File

@@ -68,12 +68,19 @@ gchar *gnc_path_get_gladedir(void);
* @returns A newly allocated string. */ * @returns A newly allocated string. */
gchar *gnc_path_get_localedir(void); gchar *gnc_path_get_localedir(void);
/** Returns the glade file path, usually /** Returns the accounts file path, usually
* "$prefix/share/gnucash/accounts". * "$prefix/share/gnucash/accounts".
* *
* @returns A newly allocated string. */ * @returns A newly allocated string. */
gchar *gnc_path_get_accountsdir(void); 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 /** Returns the gconf schema config source path, usually
* "$prefix/etc/gconf/gconf.xml.defaults". * "$prefix/etc/gconf/gconf.xml.defaults".
* *

View File

@@ -9,6 +9,7 @@
(use-modules (ice-9 slib)) (use-modules (ice-9 slib))
(use-modules (srfi srfi-13)) (use-modules (srfi srfi-13))
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
(use-modules (gnucash core-utils))
(export gnc:register-report-create) (export gnc:register-report-create)
(export gnc:register-report-hook) (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: ;; Return value:
;; List of symbols for reports ;; List of symbols for reports
(define (get-report-list) (define (get-report-list)
(map (lambda (s) (string->symbol s)) (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 "dir-files=" (directory-files (gnc-path-get-stdreportsdir)))
(gnc:debug "processed=" (process-file-list (directory-files (getenv "GNC_STANDARD_REPORTS_DIR")))) (gnc:debug "processed=" (process-file-list (directory-files (gnc-path-get-stdreportsdir))))
(gnc:debug "report-list=" (get-report-list)) (gnc:debug "report-list=" (get-report-list))
(for-each (for-each