mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[standard-reports] compact (directory-files) and remove regex
use string-suffix? instead.
This commit is contained in:
parent
a6296314a0
commit
117425305b
@ -87,23 +87,23 @@
|
|||||||
;; list of files in the directory
|
;; list of files in the directory
|
||||||
|
|
||||||
(define (directory-files dir)
|
(define (directory-files dir)
|
||||||
(if (file-exists? dir)
|
(cond
|
||||||
(let ((fname-regexp (make-regexp "\\.scm$"))
|
((file-exists? dir)
|
||||||
;; Regexp that matches the desired filenames
|
(let ((dir-stream (opendir dir)))
|
||||||
(dir-stream (opendir dir)))
|
(let loop ((fname (readdir dir-stream))
|
||||||
(let loop ((fname (readdir dir-stream))
|
(acc '()))
|
||||||
(acc '()))
|
(cond
|
||||||
(if (eof-object? fname)
|
((eof-object? fname)
|
||||||
(begin
|
(closedir dir-stream)
|
||||||
(closedir dir-stream)
|
acc)
|
||||||
acc)
|
(else
|
||||||
(loop (readdir dir-stream)
|
(loop (readdir dir-stream)
|
||||||
(if (regexp-exec fname-regexp fname)
|
(if (string-suffix? ".scm" fname)
|
||||||
(cons fname acc)
|
(cons fname acc)
|
||||||
acc)))))
|
acc)))))))
|
||||||
(begin
|
(else
|
||||||
(gnc:warn "Can't access " dir ".\nEmpty list will be returned.")
|
(gnc:warn "Can't access " dir ".\nEmpty list will be returned.")
|
||||||
'())))
|
'())))
|
||||||
|
|
||||||
;; Process a list of files by removing the ".scm" suffix if it exists
|
;; Process a list of files by removing the ".scm" suffix if it exists
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user