Greetings! Here is the best common lisp way I can see at the moment, requiring windows portability and the like:
(defun pathname-pop-slash (pn) (let ((pn (pathname pn))) (if (or (pathname-name pn) (pathname-type pn)) pn (merge-pathnames (make-pathname :directory (butlast (pathname-directory pn))) (merge-pathnames (pathname (car (last (pathname-directory pn)))) pn))))) (defun directory-exists-p (pn) (let ((pn (pathname-pop-slash pn))) (and (not (probe-file pn)) (member pn (directory pn) :test 'equal) t))) This is more direct, but of course gcl specific: (defun directory-exists-p (pn) (unless (fboundp 'si::stat) (error "No stat"));Can't remember ; exactly when ; this was added (eq :directory (car (si::stat (namestring pn))))) Please let me know if problems persist. Take care, Matt Kaufmann <[EMAIL PROTECTED]> writes: > Hi, Camm -- > > Actually, what I want to be able to do is to test whether a directory > exists, without error. Is there a way to do that in 64-bit linux GCL > 2.6.7? > > Thanks -- > -- Matt > Cc: gcl-devel@gnu.org, [EMAIL PROTECTED] > From: Camm Maguire <[EMAIL PROTECTED]> > Date: 23 Jan 2007 17:43:30 -0500 > X-SpamAssassin-Status: No, hits=-2.5 required=5.0 > X-UTCS-Spam-Status: No, hits=-250 required=200 > > Greetings! > > Yes, this has been an ansi change pushed into 2.6 to accomodate axiom, > mainly. The spec at least appears to indicate that this function > should be specific to files, though I think Paul has decided that it > is vague enough not to force an error in his test suite. In any case, > there appears to be no standard function (barring this reading) which > enables one to distinguish a file from a directory. How then might > one write, for example, a little web server on a socket which will > copy files across, but not attempt to open directories? It was > decided to therefore use probe-file to indicate a true file, and > the output of 'directory and the various pathname functions to > indicate directories. clisp does similar, if memory serves. > > truename won't work if you need to avoid error on missing pathnames, > but will otherwise. > > In general, it was felt at the time that the spec was unsatisfactory > on this point, so we have also supplied a gcl specific function, > (si::stat ...), which distinguishes files from directories, gives the > size, and the inode, at present. > > Please let me know if any of this is a problem for you. > > Take care, > > Matt Kaufmann <[EMAIL PROTECTED]> writes: > > > Hi -- > > > > I've always been able to use probe-file to see if a directory exists, > > but that doesn't seem to be working on a 64-bit linux machine, in GCL > > 2.6.7 CLtL1 or (a version of) 2.7.0 ANSI. Any suggestions? The > > following log shows that probe-file is returning nil for a directory > > that clearly exists. > > > > lhug-1:/projects/acl2/devel> ~boyer/bin-override/5 > > GCL (GNU Common Lisp) 2.7.0 ANSI Dec 5 2006 20:38:58 > > Source License: LGPL(gcl,gmp,pargcl), GPL(unexec,bfd,xgcl) > > Binary License: GPL due to GPL'ed components: (XGCL READLINE BFD > UNEXEC) > > Modifications of this banner must retain notice of a compatible license > > Dedicated to the memory of W. Schelter > > > > Use (help) to get some basic information on how to use GCL. > > > > Temporary directory for compiler files set to /tmp/ > > > > >(probe-file "/projects/acl2/devel/books/") > > > > NIL > > > > >(probe-file "/projects/acl2/devel/books") > > > > NIL > > > > >(probe-file "/projects/acl2/devel/books/certify-numbers.lisp") > > > > #P"/v/filer3/v0q004/acl2/devel/books/certify-numbers.lisp" > > > > > > > > > Thanks -- > > -- Matt > > > > > > > > -- > Camm Maguire [EMAIL > PROTECTED] > ========================================================================== > "The earth is but one country, and mankind its citizens." -- Baha'u'llah > > > -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list Gcl-devel@gnu.org http://lists.gnu.org/mailman/listinfo/gcl-devel