1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-30 23:10:21 +02:00

ftw: Fix typos/thinkos in file-system-fold' and scandir'.

* module/ice-9/ftw.scm (file-system-fold): Fix reference to STAT instead
  of ST.
  (scandir)[enter?]: Change the argument name to `dir', to avoid
  confusion.
  [skip]: Return RESULT, not #f.
This commit is contained in:
Ludovic Courtès 2011-12-19 09:18:42 +01:00
parent de92987002
commit fa8110f241

View file

@ -457,7 +457,7 @@ The optional STAT parameter defaults to `lstat'."
(else (else
(let* ((child (string-append full-name "/" entry)) (let* ((child (string-append full-name "/" entry))
(st (false-if-exception (stat child)))) (st (false-if-exception (stat child))))
(if (and stat (eq? (stat:type st) 'directory)) (if (and st (eq? (stat:type st) 'directory))
(liip (readdir dir) (liip (readdir dir)
result result
(alist-cons entry st subdirs)) (alist-cons entry st subdirs))
@ -513,8 +513,8 @@ children. The optional STAT parameter defaults to `lstat'."
that match predicate SELECT? (by default, all files.) The returned list that match predicate SELECT? (by default, all files.) The returned list
of file names is sorted according to ENTRY<?, which defaults to of file names is sorted according to ENTRY<?, which defaults to
`string-locale<?'. Return #f when NAME is unreadable or is not a directory." `string-locale<?'. Return #f when NAME is unreadable or is not a directory."
(define (enter? name stat result) (define (enter? dir stat result)
(and stat (string=? name name))) (and stat (string=? dir name)))
(define (leaf name stat result) (define (leaf name stat result)
(if (select? name) (if (select? name)
@ -529,8 +529,8 @@ of file names is sorted according to ENTRY<?, which defaults to
(cons ".." result)) (cons ".." result))
(define (skip name stat result) (define (skip name stat result)
;; NAME itself is not readable. ;; All the sub-directories are skipped.
#f) result)
(and=> (file-system-fold enter? leaf down up skip #f name stat) (and=> (file-system-fold enter? leaf down up skip #f name stat)
(lambda (files) (lambda (files)