Changeset 12533
- Timestamp:
- 03/14/10 19:09:04 (14 years ago)
- Location:
- branches/0.19.x/abcl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.19.x/abcl/doc/design/pathnames/abcl-jar-url.text
r12503 r12533 3 3 4 4 Mark Evenson 5 Created: 09 JAN 20106 Modified: 22 FEB 20105 Created: 09 JAN 2010 6 Modified: 14 MAR 2010 7 7 8 8 Notes towards sketching an implementation of "jar:" references to be … … 90 90 innermost. 91 91 92 * The DIRECTORY component of a JAR PATHNAME should be a list starting 93 with the :ABSOLUTE keyword. Even though hierarchial entries in 94 jar files are stored in the form "foo/bar/a.lisp" not 95 "/foo/bar/a.lisp", the meaning of DIRECTORY component better 96 represented as an absolute path. 97 98 BNF 99 --- 100 101 An incomplete BNF of the syntax of JAR PATHNAME would be: 102 103 JAR-PATHNAME ::= "jar:" URL "!/" [ ENTRY ] 104 105 URL ::= <URL parsable via java.net.URL.URL()> 106 | JAR-FILE-PATHNAME 107 108 JAR-FILE-PATHNAME ::= "jar:" "file:" JAR-NAMESTRING "!/" [ ENTRY ] 109 110 JAR-NAMESTRING ::= ABSOLUTE-FILE-NAMESTRING 111 | RELATIVE-FILE-NAMESTRING 112 113 ENTRY ::= [ DIRECTORY "/"]* FILE 114 115 116 ### Notes 117 118 1. ABSOLUTE-FILE-NAMESTRING and RELATIVE-FILE-NAMESTRING use the 119 local filesystem conventions, meaning that on Windows this could 120 contain '\' as the directory separator, while an ENTRY always uses '/' 121 to separate directories within the jar proper. 92 122 93 123 … … 147 177 } 148 178 pathname { 149 directory: (:RELATIVE "b" )179 directory: (:RELATIVE "b" "c") 150 180 name: "foo" 151 181 type: "abcl" … … 159 189 // UC5 -- JAR Entry in a JAR Entry 160 190 pathname: { 161 namestring: "jar:jar:file:a/foo/baz.jar!/ foo.abcl!/a/b/bar-1.cls"191 namestring: "jar:jar:file:a/foo/baz.jar!/c/d/foo.abcl!/a/b/bar-1.cls" 162 192 device: ( 163 193 pathname: { 164 d evice: "jar:file:"194 directory: (:RELATIVE "a" "foo") 165 195 name: "baz" 166 196 type: "jar" 167 197 } 168 198 pathname: { 199 directory: (:RELATIVE "c" "d") 169 200 name: "foo" 170 201 type: "abcl" 171 202 } 172 203 ) 204 directory: (:ABSOLUTE "a" "b") 173 205 name: "bar-1" 174 206 type: "cls" … … 181 213 "http://example.org/abcl.jar" 182 214 pathname: { 183 directory: (: relative"org" "armedbear" "lisp")215 directory: (:RELATIVE "org" "armedbear" "lisp") 184 216 name: "Version" 185 217 type: "class" … … 222 254 type: "jar" 223 255 ) 224 directory: (: RELATIVE "c" "d")256 directory: (:ABSOLUTE "c" "d") 225 257 name: "foo" 226 258 type: "lisp -
branches/0.19.x/abcl/src/org/armedbear/lisp/Pathname.java
r12513 r12533 288 288 device = d.device; 289 289 } 290 s = s.substring(separatorIndex + jarSeparator.length());290 s = "/" + s.substring(separatorIndex + jarSeparator.length()); 291 291 Pathname p = new Pathname(s); 292 292 directory = p.directory; … … 524 524 Debug.assertTrue(false); 525 525 } 526 sb.append(getDirectoryNamestring()); 526 String directoryNamestring = getDirectoryNamestring(); 527 if (isJar()) { 528 if (directoryNamestring.startsWith(File.separator)) { 529 sb.append(directoryNamestring.substring(1)); 530 } 531 } else { 532 sb.append(directoryNamestring); 533 } 527 534 if (name instanceof AbstractString) { 528 535 String n = name.getStringValue(); … … 627 634 p.type = type; 628 635 String path = p.getNamestring(); 636 StringBuilder result = new StringBuilder(); 629 637 if (Utilities.isPlatformWindows) { 630 StringBuilder result = new StringBuilder();631 638 for (int i = 0; i < path.length(); i++) { 632 639 char c = path.charAt(i); … … 638 645 } 639 646 return result.toString(); 640 } 641 return path; 647 } else { 648 result.append(path); 649 } 650 // Entries in jar files are always relative, but Pathname 651 // directories are :ABSOLUTE. 652 if (result.length() > 1 653 && result.substring(0, 1).equals("/")) { 654 return result.substring(1); 655 } 656 return result.toString(); 642 657 } 643 658 … … 1581 1596 } 1582 1597 1583 // A JAR always has relative directories1584 if (result.isJar()1585 && result.directory instanceof Cons1586 && result.directory.car().equals(Keyword.ABSOLUTE)) {1587 if (result.directory.cdr().equals(NIL)) {1588 result.directory = NIL;1589 } else {1590 ((Cons)result.directory).car = Keyword.RELATIVE;1591 }1592 }1598 // A JAR always has absolute directories 1599 // if (result.isJar() 1600 // && result.directory instanceof Cons 1601 // && result.directory.car().equals(Keyword.ABSOLUTE)) { 1602 // if (result.directory.cdr().equals(NIL)) { 1603 // result.directory = NIL; 1604 // } else { 1605 // ((Cons)result.directory).car = Keyword.RELATIVE; 1606 // } 1607 // } 1593 1608 1594 1609 if (pathname.name != NIL) { … … 1699 1714 if (pathname.isWild()) { 1700 1715 return error(new FileError("Bad place for a wild pathname.", 1701 pathname));1716 pathname)); 1702 1717 } 1703 1718 if (!(pathname.device instanceof Cons)) { -
branches/0.19.x/abcl/src/org/armedbear/lisp/ZipCache.java
r12504 r12533 160 160 Date date = null; 161 161 try { 162 if (dateString == null) { 163 throw new ParseException("Failed to get HEAD for " + url, 0); 164 } 162 165 date = RFC_1123.parse(dateString); 163 166 long current = date.getTime(); -
branches/0.19.x/abcl/test/lisp/abcl/jar-file.lisp
r12486 r12533 131 131 ;;; wrapped in PROGN for easy disabling without a network connection 132 132 ;;; XXX come up with a better abstraction 133 133 134 (progn 134 135 (deftest jar-file.load.11 … … 245 246 (pathname-directory p) (pathname-name p) (pathname-type p))) 246 247 "baz" "jar" 247 nil"foo" "abcl")248 (:absolute) "foo" "abcl") 248 249 249 250 (deftest jar-file.pathname.3 … … 267 268 (:relative "a") "baz" "jar" 268 269 (:relative "b" "c") "foo" "abcl" 269 (: relative "this" "that") "foo-20" "cls")270 (:absolute "this" "that") "foo-20" "cls") 270 271 271 272 (deftest jar-file.pathname.5 … … 279 280 (:relative "a" "foo" ) "baz" "jar" 280 281 (:relative "b" "c") "foo" "abcl" 281 (: relative "armed" "bear") "bar-1" "cls")282 (:absolute "armed" "bear") "bar-1" "cls") 282 283 283 284 (deftest jar-file.pathname.6 … … 289 290 (pathname-directory p) (pathname-name p) (pathname-type p))) 290 291 "http://example.org/abcl.jar" 291 (: relative "org" "armedbear" "lisp") "Version" "class")292 (:absolute "org" "armedbear" "lisp") "Version" "class") 292 293 293 294 (deftest jar-file.pathname.7 … … 317 318 (pathname-directory d) (pathname-name d) (pathname-type d) 318 319 (pathname-directory p) (pathname-name p) (pathname-type p))) 319 (: RELATIVE"a" "b") "foo" "jar"320 (: RELATIVE"c" "d") "foo" "lisp")320 (:relative "a" "b") "foo" "jar" 321 (:absolute "c" "d") "foo" "lisp") 321 322 322 323
Note: See TracChangeset
for help on using the changeset viewer.