[Openmcl-devel] directory, create-directory, ...
Chun Tian (binghe)
binghe.lisp at gmail.com
Mon Oct 6 11:15:49 PDT 2008
Try this one:
(directory (make-pathname :name :wild :type :wild :defaults #p"/x/
y/") :directories t)
or just
(directory #p"/x/y/*.*" :directories t)
I think you'd better use CL-FAD package instead. I just learn above by
reading CL-FAD's LIST-DIRECTORY function:
(defun list-directory (dirname)
"Returns a fresh list of pathnames corresponding to the truenames of
all files within the directory named by the non-wild pathname
designator DIRNAME. The pathnames of sub-directories are returned in
directory form - see PATHNAME-AS-DIRECTORY."
(when (wild-pathname-p dirname)
(error "Can only list concrete directory names."))
#+:ecl
(let ((dir (pathname-as-directory dirname)))
(concatenate 'list
(directory (merge-pathnames (pathname "*/") dir))
(directory (merge-pathnames (pathname "*.*") dir))))
#-:ecl
(let ((wildcard (directory-wildcard dirname)))
#+:abcl (system::list-directory dirname)
#+(or :sbcl :cmu :scl :lispworks) (directory wildcard)
#+(or :openmcl :digitool) (directory wildcard :directories t)
#+:allegro (directory wildcard :directories-are-files nil)
#+:clisp (nconc (directory wildcard :if-does-not-exist :keep)
(directory (clisp-subdirectories-wildcard
wildcard)))
#+:cormanlisp (nconc (directory wildcard)
(cl::directory-subdirs dirname)))
#-
(or
:sbcl
:cmu
:scl
:lispworks :openmcl :allegro :clisp :cormanlisp :ecl :abcl :digitool)
(error "LIST-DIRECTORY not implemented"))
--binghe
>
> I sent this out, but I think I forgot to include the group...
>
> Anyway, yes, (directory "/x/y/*.lisp") for example does what you would
> expect. Using only a wild card though doesn't get all files:
> (directory
> "/x/y/*") => nil. You can use (directory "/x/y/*.*") but that would
> seem
> to indicate only files with a "." in their name. It may be that
> this is
> where the various keywords to directory come into play. Are/where are
> these described? Also, R.Stoye informed me that the MODE keyword for
> create-directory is for indicating the unix mode/permissions for the
> directory. Again, where is this impl specific type stuff described
> for
> CCL? For example, I now know what MODE is for, but still don't know
> how it
> is specified (ala' chmod or ???)
>
> Thanks!
>
> /Jon
>
>
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://link.mail2web.com/mail2web
>
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel
mailing list