gnucash maint: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Mon Nov 17 08:52:41 EST 2014
Updated via https://github.com/Gnucash/gnucash/commit/22490a37 (commit)
via https://github.com/Gnucash/gnucash/commit/64d9a3b9 (commit)
from https://github.com/Gnucash/gnucash/commit/d6826976 (commit)
commit 22490a37abcef966b5523cc60b184be0e6459c94
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Mon Nov 17 14:01:07 2014 +0100
Fix build-time hard-coded path introduced by the guile2 compile changes
These changes hardcoded the standards-reports path at build time.
On Windows and OS X the final path is only known at installation time.
So after installation the build-time hard-coded path would be invalid and
the standard-reports directory could no longer be found.
diff --git a/src/core-utils/gnc-path.c b/src/core-utils/gnc-path.c
index d8f92fd..9b06259 100644
--- a/src/core-utils/gnc-path.c
+++ b/src/core-utils/gnc-path.c
@@ -162,8 +162,18 @@ gchar *gnc_path_get_reportdir()
}
else
{
+ /* Careful: if the autoconf macro GNC_SCM_INSTALL_DIR gets changed
+ * in configure.ac, this path should probably change as well.
+ * Currently this code assumes GNC_SCM_INSTALL_DIR is set to
+ * pkgdatadir/scm
+ * We can't use the AC_MACRO GNC_SCM_INSTALL_DIR here directly
+ * because that's expanded at build time. On Windows and OS X
+ * the final path may get installed in a different location
+ * than assumed during build, invalidating the build path at
+ * runtime.
+ */
gchar *pkgdatadir = gnc_path_get_pkgdatadir ();
- result = g_build_filename (GNC_SCM_INSTALL_DIR,
+ result = g_build_filename (pkgdatadir, "scm",
"gnucash", "report", (char*)NULL);
g_free (pkgdatadir);
}
commit 64d9a3b99e6f6b8ac7b70d63a442c60975e6e603
Author: Geert Janssens <janssens-geert at telenet.be>
Date: Mon Nov 17 15:43:16 2014 +0100
Prevent crash when standards-report dir doesn't exist
diff --git a/src/report/standard-reports/standard-reports.scm b/src/report/standard-reports/standard-reports.scm
index 85d0c38..8497b09 100644
--- a/src/report/standard-reports/standard-reports.scm
+++ b/src/report/standard-reports/standard-reports.scm
@@ -74,24 +74,29 @@
;; list of files in the directory
(define (directory-files dir)
- (let ((fname-regexp (make-regexp "\\.scm$")) ;; Regexp that matches the desired filenames
- (dir-stream (opendir dir)))
- (let loop ((fname (readdir dir-stream))
- (acc '())
- )
- (if (eof-object? fname)
- (begin
- (closedir dir-stream)
- acc
- )
- (loop (readdir dir-stream)
- (if (regexp-exec fname-regexp fname)
- (cons fname acc)
- acc
- )
- )
- )
- )
+ (if (file-exists? dir)
+ (let ((fname-regexp (make-regexp "\\.scm$")) ;; Regexp that matches the desired filenames
+ (dir-stream (opendir dir)))
+
+ (let loop ((fname (readdir dir-stream))
+ (acc '()))
+ (if (eof-object? fname)
+ (begin
+ (closedir dir-stream)
+ acc
+ )
+ (loop (readdir dir-stream)
+ (if (regexp-exec fname-regexp fname)
+ (cons fname acc)
+ acc
+ )
+ )
+ )
+ ))
+ (begin
+ (gnc:warn "Can't access " dir ".\nEmpty list will be returned.")
+ '() ;; return empty list
+ )
)
)
@@ -113,9 +118,8 @@
;; Return value:
;; List of symbols for reports
(define (get-report-list)
- (map (lambda (s) (string->symbol s))
- (process-file-list (directory-files (gnc-path-get-stdreportsdir)))
- )
+ (map (lambda (s) (string->symbol s))
+ (process-file-list (directory-files (gnc-path-get-stdreportsdir))))
)
(gnc:debug "stdrpt-dir=" (gnc-path-get-stdreportsdir))
Summary of changes:
src/core-utils/gnc-path.c | 12 ++++++-
src/report/standard-reports/standard-reports.scm | 46 +++++++++++++-----------
2 files changed, 36 insertions(+), 22 deletions(-)
More information about the gnucash-changes
mailing list