CL-USER> (DIRECTORY "jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp") Calling (DIRECTORY "jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp") DIRECTORY returned #<FILE-ERROR {E2C42F}> #<FILE-ERROR {E2C42F}> CL-USER> (describe *) #<FILE-ERROR {E2C42F}> is an instance of #<STANDARD-CLASS FILE-ERROR {8917A2}>. The following slots have :INSTANCE allocation: FORMAT-CONTROL "Not a wild pathname." FORMAT-ARGUMENTS NIL PATHNAME #P"jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp" ; No value
Below is the function I use for directory in jars. Please consider including it until there is a correct implementation in java.
(defun directory-in-jar (pathname) (let* ((device (pathname-device pathname)) (jarfile (namestring (car device))) (rest-pathname (namestring (make-pathname :directory `(:absolute ,@(cdr (pathname-directory pathname))) :name (pathname-name pathname) :type (pathname-type pathname))))) (if (or (position #* (namestring rest-pathname)) (wild-pathname-p rest-pathname)) (let ((jar (jnew "java.util.zip.ZipFile" jarfile))) (let ((els (jcall "entries" jar))) (loop while (jcall "hasMoreElements" els) for name = (jcall "getName" (jcall "nextElement" els)) when (pathname-match-p (concatenate 'string "/" name) rest-pathname) collect (make-pathname :device (pathname-device pathname) :name (pathname-name name) :type (pathname-type name) :directory `(:relative ,@(cdr (pathname-directory name))))))) (let ((truename (probe-file pathname))) (if truename (list truename) nil)))))
On May 11, 2010, at 4:37 AM, Alan Ruttenberg wrote:
CL-USER> (DIRECTORY "jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp") Calling (DIRECTORY "jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp") DIRECTORY returned #<FILE-ERROR {E2C42F}>
This turned out to be a problem with WILD-PATHNAME-P not detecting wildcards in components which were string (i.e. (WILD-PATHNAME-P "foo*bar") was returning nil), which I have fixed in [r12667][1] for "*" occuring in DIRECTORY, NAME, and TYPE string components. The rules for HOST and DEVICE would be a little more complicated, which I don't have time at the moment.
[1]: http://trac.common-lisp.net/armedbear/changeset/12667
Below is the function I use for directory in jars. Please consider including it until there is a correct implementation in java.
[…]
This is identical to the algorithm implemented in Pathname.java:match-wild-jar-pathname (I think I aped your implementation into Java). I had coded a further check that the argument was indeed a wild pathname, which was failing due to a faulty WILD-PATHNAME-P implementation.
-- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
On Tue, May 11, 2010 at 10:52 AM, Mark Evenson evenson@panix.com wrote:
On May 11, 2010, at 4:37 AM, Alan Ruttenberg wrote:
CL-USER> (DIRECTORY "jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp") Calling (DIRECTORY "jar:file:/Users/alanr/Desktop/jar2go.jar!/abcl-module-*.lisp") DIRECTORY returned #<FILE-ERROR {E2C42F}>
This turned out to be a problem with WILD-PATHNAME-P not detecting wildcards in components which were string (i.e. (WILD-PATHNAME-P "foo*bar") was returning nil), which I have fixed in [r12667][1] for "*" occuring in DIRECTORY, NAME, and TYPE string components. The rules for HOST and DEVICE would be a little more complicated, which I don't have time at the moment.
Below is the function I use for directory in jars. Please consider including it until there is a correct implementation in java.
[…]
This is identical to the algorithm implemented in Pathname.java:match-wild-jar-pathname (I think I aped your implementation into Java). I had coded a further check that the argument was indeed a wild pathname, which was failing due to a faulty WILD-PATHNAME-P implementation.
Verified to work for me. Thanks.
-Alan
-- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
armedbear-devel mailing list armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
armedbear-devel@common-lisp.net