[Ecls-list] Getting on directories with DIRECTORY
Julian Fondren
ayrnieu at gmail.com
Wed Sep 6 18:59:30 UTC 2006
Goffioul Michael <goffioul at ...> writes:
> I'm trying to get only directory entries in a specified location.
> I tried DIRECTORY, but I notice a different behavior between ECL
> (which does not what I want) and CLISP (which does). When I type
http://www.gigamonkeys.com/book/practical-a-portable-pathname-library.html
This chapter of PCL explains filesystem problems with Common Lisp, although it
doesn't refer to ECL, and has you program though them. This quoted code that
works over all the variants of PROBE-FILE might also give you the idea :-)
(defun file-exists-p (pathname)
#+(or sbcl lispworks openmcl)
(probe-file pathname)
#+(or allegro cmu)
(or (probe-file (pathname-as-directory pathname))
(probe-file pathname))
#+clisp
(or (ignore-errors
(probe-file (pathname-as-file pathname)))
(ignore-errors
(let ((directory-form (pathname-as-directory pathname)))
(when (ext:probe-directory directory-form)
directory-form))))
#-(or sbcl cmu lispworks openmcl allegro clisp)
(error "file-exists-p not implemented"))
More information about the ecl-devel
mailing list