dirname -> dir-name
This commit is contained in:
parent
76f91f8abb
commit
8dc4af1e38
|
@ -57,7 +57,7 @@
|
||||||
;;; test stuff
|
;;; test stuff
|
||||||
|
|
||||||
;(dir-stream-display
|
;(dir-stream-display
|
||||||
; (dir-stream-filter (dir-stream-from-dirname "/Users/eric/tmp")
|
; (dir-stream-filter (dir-stream-from-dir-name "/Users/eric/tmp")
|
||||||
; (lambda (fs-object)
|
; (lambda (fs-object)
|
||||||
; (display (fs-object-mtime fs-object))
|
; (display (fs-object-mtime fs-object))
|
||||||
; (newline)
|
; (newline)
|
||||||
|
|
|
@ -47,18 +47,18 @@
|
||||||
(fs-object-name fs-object)))
|
(fs-object-name fs-object)))
|
||||||
|
|
||||||
|
|
||||||
(define (dir-stream-from-dirname dirname . args)
|
(define (dir-stream-from-dir-name dir-name . args)
|
||||||
;; skip file in case of an error during file-info
|
;; skip file in case of an error during file-info
|
||||||
(define (next-info ds parent dirname chase?)
|
(define (next-info ds parent dir-name chase?)
|
||||||
(let ((file (read-directory-stream ds)))
|
(let ((file (read-directory-stream ds)))
|
||||||
(if file
|
(if file
|
||||||
(call-with-current-continuation
|
(call-with-current-continuation
|
||||||
(lambda (k)
|
(lambda (k)
|
||||||
(with-handler
|
(with-handler
|
||||||
(lambda (cond more)
|
(lambda (cond more)
|
||||||
(k (next-info ds parent dirname chase?)))
|
(k (next-info ds parent dir-name chase?)))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(cons (make-fs-object (combine-path parent dirname)
|
(cons (make-fs-object (combine-path parent dir-name)
|
||||||
file
|
file
|
||||||
chase?)
|
chase?)
|
||||||
ds)))))
|
ds)))))
|
||||||
|
@ -66,16 +66,16 @@
|
||||||
(let-optionals args ((chase? #t) (parent ""))
|
(let-optionals args ((chase? #t) (parent ""))
|
||||||
(let ((info-stream (stream-unfold
|
(let ((info-stream (stream-unfold
|
||||||
(lambda (ds)
|
(lambda (ds)
|
||||||
(next-info ds parent dirname chase?))
|
(next-info ds parent dir-name chase?))
|
||||||
(call-with-current-continuation
|
(call-with-current-continuation
|
||||||
(lambda (k)
|
(lambda (k)
|
||||||
(with-handler
|
(with-handler
|
||||||
(lambda (cond more)
|
(lambda (cond more)
|
||||||
(make-empty-stream))
|
(make-empty-stream))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(open-directory-stream (combine-path parent dirname)))))))))
|
(open-directory-stream (combine-path parent dir-name)))))))))
|
||||||
(make-dir-stream
|
(make-dir-stream
|
||||||
(make-fs-object parent dirname chase?)
|
(make-fs-object parent dir-name chase?)
|
||||||
(stream-filter-map
|
(stream-filter-map
|
||||||
(lambda (fso) (and (not (file-info-dir? (fs-object-info fso)))
|
(lambda (fso) (and (not (file-info-dir? (fs-object-info fso)))
|
||||||
fso))
|
fso))
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
(stream-filter-map
|
(stream-filter-map
|
||||||
(lambda (fso)
|
(lambda (fso)
|
||||||
(and (file-info-dir? (fs-object-info fso))
|
(and (file-info-dir? (fs-object-info fso))
|
||||||
(dir-stream-from-dirname
|
(dir-stream-from-dir-name
|
||||||
(fs-object-name fso) chase? (fs-object-parent fso))))
|
(fs-object-name fso) chase? (fs-object-parent fso))))
|
||||||
info-stream)))))
|
info-stream)))))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(define-interface dir-streams-interface
|
(define-interface dir-streams-interface
|
||||||
(export dir-stream-from-dirname
|
(export dir-stream-from-dir-name
|
||||||
dir-stream-for-each
|
dir-stream-for-each
|
||||||
dir-stream-map
|
dir-stream-map
|
||||||
dir-stream-filter
|
dir-stream-filter
|
||||||
|
|
Loading…
Reference in New Issue