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,21 +87,21 @@
|
||||
;; list of files in the directory
|
||||
|
||||
(define (directory-files dir)
|
||||
(if (file-exists? dir)
|
||||
(let ((fname-regexp (make-regexp "\\.scm$"))
|
||||
;; Regexp that matches the desired filenames
|
||||
(dir-stream (opendir dir)))
|
||||
(cond
|
||||
((file-exists? dir)
|
||||
(let ((dir-stream (opendir dir)))
|
||||
(let loop ((fname (readdir dir-stream))
|
||||
(acc '()))
|
||||
(if (eof-object? fname)
|
||||
(begin
|
||||
(cond
|
||||
((eof-object? fname)
|
||||
(closedir dir-stream)
|
||||
acc)
|
||||
(else
|
||||
(loop (readdir dir-stream)
|
||||
(if (regexp-exec fname-regexp fname)
|
||||
(if (string-suffix? ".scm" fname)
|
||||
(cons fname acc)
|
||||
acc)))))
|
||||
(begin
|
||||
acc)))))))
|
||||
(else
|
||||
(gnc:warn "Can't access " dir ".\nEmpty list will be returned.")
|
||||
'())))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user