utils: Make the second 'find-files' argument optional.

* guix/build/utils.scm (find-files): Make 'pred' optional.
This commit is contained in:
Ludovic Courtès 2015-04-01 15:43:54 +02:00
parent 8ff3df5baa
commit 4ba3a84d07

View file

@ -273,11 +273,12 @@ (define (file-name-predicate regexp)
(lambda (file stat) (lambda (file stat)
(regexp-exec file-rx (basename file))))) (regexp-exec file-rx (basename file)))))
(define (find-files dir pred) (define* (find-files dir #:optional (pred (const #t)))
"Return the lexicographically sorted list of files under DIR for which PRED "Return the lexicographically sorted list of files under DIR for which PRED
returns true. PRED is passed two arguments: the absolute file name, and its returns true. PRED is passed two arguments: the absolute file name, and its
stat buffer. PRED can also be a regular expression, in which case it is stat buffer; the default predicate always returns true. PRED can also be a
equivalent to (file-name-predicate PRED)." regular expression, in which case it is equivalent to (file-name-predicate
PRED)."
(let ((pred (if (procedure? pred) (let ((pred (if (procedure? pred)
pred pred
(file-name-predicate pred)))) (file-name-predicate pred))))