summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-26 21:49:25 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-26 21:49:25 +0200
commit548e0af4da4e2e9311bc696831a80eedbc5b5798 (patch)
treee98dd2c4dc60cb3c11f792de5dc464110b3d7236
parentd23a00b599be56694065bd274184b9289fb8b85c (diff)
downloadguix-548e0af4da4e2e9311bc696831a80eedbc5b5798.tar.gz
discovery: 'scheme-files' ignores hidden files.
* guix/discovery.scm (scheme-files)[dot-prefixed?]: New procedure.
Use it to exclude any file starting with ".".
-rw-r--r--guix/discovery.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 468b6c59de..7c5fed7f0e 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -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)))