From 259913ee835afda0f1277a5df424560cdbaed234 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 13 Jan 2012 07:15:15 -0700 Subject: [PATCH] fix `find-files' to convert an initial string into a path Merge to 5.2.1 (cherry picked from commit 60c418b20ea2e1c8218c653c259b5ca1fa690943) --- collects/racket/file.rkt | 3 ++- collects/tests/racket/filelib.rktl | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/collects/racket/file.rkt b/collects/racket/file.rkt index 6a768e6704..d7b808c922 100644 --- a/collects/racket/file.rkt +++ b/collects/racket/file.rkt @@ -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 diff --git a/collects/tests/racket/filelib.rktl b/collects/tests/racket/filelib.rktl index c3eeb32f6e..3212c5e6f0 100644 --- a/collects/tests/racket/filelib.rktl +++ b/collects/tests/racket/filelib.rktl @@ -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)