Changeset 12531
- Timestamp:
- 03/14/10 13:30:17 (14 years ago)
- Location:
- trunk/abcl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/doc/design/pathnames/abcl-jar-url.text
r12523 r12531 3 3 4 4 Mark Evenson 5 Created: 09 JAN 20106 Modified: 22 FEB 20105 Created: 09 JAN 2010 6 Modified: 16 MAR 2010 7 7 8 8 Notes towards sketching an implementation of "jar:" references to be … … 91 91 92 92 * The DIRECTORY component of a JAR PATHNAME should be a list starting 93 with the :RELATIVE keyword, as hierarchial entries in jar files 94 are of the form "foo/bar/a.lisp" not "/foo/bar/a.lisp" 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. 95 97 96 98 BNF … … 109 111 | RELATIVE-FILE-NAMESTRING 110 112 111 ENTRY ::= [ DIRECTORY "/"] 113 ENTRY ::= [ DIRECTORY "/"]* FILE 112 114 113 115 … … 175 177 } 176 178 pathname { 177 directory: (:RELATIVE "b" )179 directory: (:RELATIVE "b" "c") 178 180 name: "foo" 179 181 type: "abcl" … … 187 189 // UC5 -- JAR Entry in a JAR Entry 188 190 pathname: { 189 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" 190 192 device: ( 191 193 pathname: { 192 d evice: "jar:file:"194 directory: (:RELATIVE "a" "foo") 193 195 name: "baz" 194 196 type: "jar" 195 197 } 196 198 pathname: { 199 directory: (:RELATIVE "c" "d") 197 200 name: "foo" 198 201 type: "abcl" 199 202 } 200 203 ) 204 directory: (:ABSOLUTE "a" "b") 201 205 name: "bar-1" 202 206 type: "cls" … … 209 213 "http://example.org/abcl.jar" 210 214 pathname: { 211 directory: (: relative"org" "armedbear" "lisp")215 directory: (:RELATIVE "org" "armedbear" "lisp") 212 216 name: "Version" 213 217 type: "class" … … 250 254 type: "jar" 251 255 ) 252 directory: (: RELATIVE "c" "d")256 directory: (:ABSOLUTE "c" "d") 253 257 name: "foo" 254 258 type: "lisp -
trunk/abcl/src/org/armedbear/lisp/Pathname.java
r12524 r12531 297 297 device = d.device; 298 298 } 299 s = s.substring(separatorIndex + jarSeparator.length());299 s = "/" + s.substring(separatorIndex + jarSeparator.length()); 300 300 Pathname p = new Pathname(s); 301 301 directory = p.directory; … … 533 533 Debug.assertTrue(false); 534 534 } 535 sb.append(getDirectoryNamestring()); 535 String directoryNamestring = getDirectoryNamestring(); 536 if (isJar()) { 537 if (directoryNamestring.startsWith(File.separator)) { 538 sb.append(directoryNamestring.substring(1)); 539 } 540 } else { 541 sb.append(directoryNamestring); 542 } 536 543 if (name instanceof AbstractString) { 537 544 String n = name.getStringValue(); … … 636 643 p.type = type; 637 644 String path = p.getNamestring(); 645 StringBuilder result = new StringBuilder(); 638 646 if (Utilities.isPlatformWindows) { 639 StringBuilder result = new StringBuilder();640 647 for (int i = 0; i < path.length(); i++) { 641 648 char c = path.charAt(i); … … 647 654 } 648 655 return result.toString(); 649 } 650 return path; 656 } else { 657 result.append(path); 658 } 659 // Entries in jar files are always relative, but Pathname 660 // directories are :ABSOLUTE. 661 if (result.length() > 1 662 && result.substring(0, 1).equals("/")) { 663 return result.substring(1); 664 } 665 return result.toString(); 651 666 } 652 667 … … 1590 1605 } 1591 1606 1592 // A JAR always has relative directories1593 if (result.isJar()1594 && result.directory instanceof Cons1595 && result.directory.car().equals(Keyword.ABSOLUTE)) {1596 if (result.directory.cdr().equals(NIL)) {1597 result.directory = NIL;1598 } else {1599 ((Cons)result.directory).car = Keyword.RELATIVE;1600 }1601 }1607 // A JAR always has absolute directories 1608 // if (result.isJar() 1609 // && result.directory instanceof Cons 1610 // && result.directory.car().equals(Keyword.ABSOLUTE)) { 1611 // if (result.directory.cdr().equals(NIL)) { 1612 // result.directory = NIL; 1613 // } else { 1614 // ((Cons)result.directory).car = Keyword.RELATIVE; 1615 // } 1616 // } 1602 1617 1603 1618 if (pathname.name != NIL) { … … 1708 1723 if (pathname.isWild()) { 1709 1724 return error(new FileError("Bad place for a wild pathname.", 1710 pathname));1725 pathname)); 1711 1726 } 1712 1727 if (!(pathname.device instanceof Cons)) { -
trunk/abcl/src/org/armedbear/lisp/ZipCache.java
r12504 r12531 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(); -
trunk/abcl/test/lisp/abcl/jar-file.lisp
r12486 r12531 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.