From 47cdcaded35612ba8a5e4dca6d37c9150a2e20b7 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 2 Mar 2019 15:40:18 +0800 Subject: [PATCH] [standard-reports] drop (process-file-list) The list of reports is obtained by scanning the standard-reports folder for *.scm, then processes the filenames by removing ".scm". Process the removal directly. --- .../standard-reports/standard-reports.scm | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/gnucash/report/standard-reports/standard-reports.scm b/gnucash/report/standard-reports/standard-reports.scm index 0902bae421..235f763c83 100644 --- a/gnucash/report/standard-reports/standard-reports.scm +++ b/gnucash/report/standard-reports/standard-reports.scm @@ -99,40 +99,21 @@ (else (loop (readdir dir-stream) (if (string-suffix? ".scm" fname) - (cons fname acc) + (cons (string-drop-right fname 4) acc) acc))))))) (else (gnc:warn "Can't access " dir ".\nEmpty list will be returned.") '()))) -;; Process a list of files by removing the ".scm" suffix if it exists -;; -;; Param: -;; l - list of files -;; -;; Return value: -;; List of files with .scm suffix removed -(define (process-file-list l) - (map - (lambda (s) - (if (string-suffix? ".scm" s) - (string-drop-right s 4) - s)) - l)) - ;; 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 (gnc-path-get-stdreportsdir))))) + (map string->symbol (directory-files (gnc-path-get-stdreportsdir)))) (gnc:debug "stdrpt-dir=" (gnc-path-get-stdreportsdir)) (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