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:
parent
d23a00b599
commit
548e0af4da
|
@ -51,13 +51,15 @@ DIRECTORY is not accessible."
|
||||||
((? symbol? type)
|
((? symbol? type)
|
||||||
type)))
|
type)))
|
||||||
|
|
||||||
|
(define (dot-prefixed? file)
|
||||||
|
(string-prefix? "." file))
|
||||||
|
|
||||||
;; Use 'scandir*' so we can avoid an extra 'lstat' for each entry, as
|
;; Use 'scandir*' so we can avoid an extra 'lstat' for each entry, as
|
||||||
;; opposed to Guile's 'scandir' or 'file-system-fold'.
|
;; opposed to Guile's 'scandir' or 'file-system-fold'.
|
||||||
(fold-right (lambda (entry result)
|
(fold-right (lambda (entry result)
|
||||||
(match entry
|
(match entry
|
||||||
(("." . _)
|
(((? dot-prefixed?) . _)
|
||||||
result)
|
;; Exclude ".", "..", and hidden files such as backups.
|
||||||
((".." . _)
|
|
||||||
result)
|
result)
|
||||||
((name . properties)
|
((name . properties)
|
||||||
(let ((absolute (string-append directory "/" name)))
|
(let ((absolute (string-append directory "/" name)))
|
||||||
|
|
Loading…
Reference in New Issue