fix `find-files' to convert an initial string into a path

Merge to 5.2.1
This commit is contained in:
Matthew Flatt 2012-01-13 07:15:15 -07:00
parent 108c32e11f
commit 60c418b20e
2 changed files with 8 additions and 1 deletions

View File

@ -546,7 +546,8 @@
(define (do-paths paths acc)
(cond [(null? paths) acc]
[else (do-paths (cdr paths) (do-path (car paths) acc))]))
(if path (do-path path init) (do-paths (sorted-dirlist) init)))
(define (to-path s) (if (path? s) s (string->path s)))
(if path (do-path (to-path path) init) (do-paths (sorted-dirlist) init)))
(define (find-files f [path #f])
(reverse

View File

@ -68,6 +68,12 @@
(test (list (build-path (current-directory) "filelib.rktl"))
find-files (lambda (f) (regexp-match "filelib[.]rktl$" (path->string f)))
(current-directory))
;; check that path as string gives paths (not strings) to checker and result:
(test (list (current-directory)
(build-path (current-directory) "filelib.rktl"))
find-files (lambda (f) (or (equal? f (current-directory))
(regexp-match "filelib[.]rktl$" (path->string f))))
(path->string (current-directory)))
(let ([rel2 (fold-files (lambda (name kind accum)
(test kind name (if (file-exists? name)