diff --git a/collects/mzlib/file.ss b/collects/mzlib/file.ss index eca2e928c9..a794743bde 100644 --- a/collects/mzlib/file.ss +++ b/collects/mzlib/file.ss @@ -478,9 +478,13 @@ (define (do-path path acc) (cond [(and (not follow-links?) (link-exists? path)) (f path 'link acc)] [(directory-exists? path) - (do-paths (map (lambda (p) (build-path path p)) - (directory-list path)) - (f path 'dir acc))] + (call-with-values (lambda () (f path 'dir acc)) + (lambda (acc . descend?) + (if (if (pair? descend?) (car descend?) #t) + (do-paths (map (lambda (p) (build-path path p)) + (directory-list path)) + acc) + acc)))] [(file-exists? path) (f path 'file acc)] [(link-exists? path) (f path 'link acc)] ; dangling links [else (error 'fold-files "path disappeared: ~e" path)]))