3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

discovery: 'scheme-files' ignores hidden files.

* guix/discovery.scm (scheme-files)[dot-prefixed?]: New procedure.
Use it to exclude any file starting with ".".
This commit is contained in:
Ludovic Courtès 2019-07-26 21:49:25 +02:00
parent d23a00b599
commit 548e0af4da
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -51,13 +51,15 @@ DIRECTORY is not accessible."
((? symbol? type)
type)))
(define (dot-prefixed? file)
(string-prefix? "." file))
;; Use 'scandir*' so we can avoid an extra 'lstat' for each entry, as
;; opposed to Guile's 'scandir' or 'file-system-fold'.
(fold-right (lambda (entry result)
(match entry
(("." . _)
result)
((".." . _)
(((? dot-prefixed?) . _)
;; Exclude ".", "..", and hidden files such as backups.
result)
((name . properties)
(let ((absolute (string-append directory "/" name)))