Handling case where opendir fails in directory-fold-tree.

This commit is contained in:
Alex Shinn 2013-10-03 09:37:33 +09:00
parent 8ddee1f704
commit 3c8c1fe74b

View file

@ -49,17 +49,18 @@
(cond (cond
((file-directory? file) ((file-directory? file)
(let ((d (opendir file))) (let ((d (opendir file)))
(let lp ((acc acc)) (if (not d)
(let ((e (readdir d))) (let lp ((acc acc))
(cond (let ((e (readdir d)))
(e (cond
(let ((f (dirent-name e))) (e
(if (member f '("." "..")) (let ((f (dirent-name e)))
(lp acc) (if (member f '("." ".."))
(let ((path (string-append file "/" f))) (lp acc)
(lp (fold path (down path acc))))))) (let ((path (string-append file "/" f)))
(else (lp (fold path (down path acc)))))))
(up file acc))))))) (else
(up file acc))))))))
(else (else
(here file acc)))))) (here file acc))))))