Changeset 13033
- Timestamp:
- 11/20/10 14:36:57 (13 years ago)
- Location:
- branches/0.23.x/abcl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.23.x/abcl/CHANGES
r13003 r13033 16 16 Fixes 17 17 ----- 18 19 * [ticket #110][svn r13024,r13026] Fix #\+ in JAR pathnames does not work 18 20 19 21 * [svn r12995-12997] Changes to generated byte code to prevent JRockit JVM -
branches/0.23.x/abcl/src/org/armedbear/lisp/Pathname.java
r13006 r13033 197 197 public Pathname(URL url) { 198 198 if ("file".equals(url.getProtocol())) { 199 String s; 200 try { 201 s = URLDecoder.decode(url.getPath(), "UTF-8"); 202 } catch (java.io.UnsupportedEncodingException uee) { 203 // Can't happen: every Java is supposed to support 204 // at least UTF-8 encoding 205 Debug.assertTrue(false); 206 s = null; 207 } 199 String s = url.getPath(); 208 200 if (s != null) { 209 210 211 201 if (Utilities.isPlatformWindows) { 202 // Workaround for Java's idea of URLs 203 // new (URL"file:///c:/a/b").getPath() --> "/c:/a/b" 212 204 // whereas we need "c" to be the DEVICE. 213 214 215 216 217 218 205 if (s.length() > 2 206 && s.charAt(0) == '/' 207 && s.charAt(2) == ':') { 208 s = s.substring(1); 209 } 210 } 219 211 init(s); 220 212 return; … … 652 644 if (type instanceof AbstractString) { 653 645 String t = type.getStringValue(); 654 655 656 657 658 659 660 646 // Allow Windows shortcuts to include TYPE 647 if (!(t.endsWith(".lnk") && Utilities.isPlatformWindows)) { 648 if (t.indexOf('.') >= 0) { 649 Debug.assertTrue(namestring == null); 650 return null; 651 } 652 } 661 653 sb.append(t); 662 654 } else if (type == Keyword.WILD) { … … 2094 2086 } else { 2095 2087 ZipEntry entry = jarFile.getEntry(entryPath); 2096 2097 2098 2088 if (entry == null) { 2089 Debug.trace("Failed to get InputStream for " 2090 + "'" + getNamestring() + "'"); 2099 2091 // XXX should this be fatal? 2100 2101 2092 Debug.assertTrue(false); 2093 } 2102 2094 try { 2103 2095 result = jarFile.getInputStream(entry); … … 2268 2260 if (Utilities.isPlatformWindows) { 2269 2261 if (destination.isFile()) { 2270 2262 ZipCache.remove(destination); 2271 2263 destination.delete(); 2272 2264 } … … 2328 2320 2329 2321 public URL toURL() throws MalformedURLException { 2330 2331 2332 2333 2334 2322 if(isURL()) { 2323 return new URL(getNamestring()); 2324 } else { 2325 return toFile().toURL(); 2326 } 2335 2327 } 2336 2328 2337 2329 public File toFile() { 2338 2339 2340 2341 2342 2330 if(!isURL()) { 2331 return new File(getNamestring()); 2332 } else { 2333 throw new RuntimeException(this + " does not represent a file"); 2334 } 2343 2335 } 2344 2336 -
branches/0.23.x/abcl/test/lisp/abcl/jar-pathname.lisp
r12949 r13033 40 40 (compile-file "bar.lisp") 41 41 (compile-file "eek.lisp") 42 (let* ((dir (merge-pathnames "tmp/" *abcl-test-directory*)) 43 (sub (merge-pathnames "a/b/" dir))) 44 (when (probe-directory dir) 45 (delete-directory-and-files dir)) 46 (ensure-directories-exist sub) 47 (sys:unzip (merge-pathnames "foo.abcl") 48 dir) 49 (sys:unzip (merge-pathnames "foo.abcl") 50 sub) 42 (let* ((tmpdir (merge-pathnames "tmp/" *abcl-test-directory*)) 43 (subdirs 44 (mapcar (lambda (p) (merge-pathnames p tmpdir)) 45 '("a/b/" "d/e+f/"))) 46 (sub1 (first subdirs)) 47 (sub2 (second subdirs))) 48 (when (probe-directory tmpdir) 49 (delete-directory-and-files tmpdir)) 50 (mapcar (lambda (p) (ensure-directories-exist p)) subdirs) 51 (sys:unzip (merge-pathnames "foo.abcl") tmpdir) 52 (sys:unzip (merge-pathnames "foo.abcl") sub1) 51 53 (cl-fad-copy-file (merge-pathnames "bar.abcl") 52 (merge-pathnames "bar.abcl"dir))54 (merge-pathnames "bar.abcl" tmpdir)) 53 55 (cl-fad-copy-file (merge-pathnames "bar.abcl") 54 (merge-pathnames "bar.abcl" sub)) 56 (merge-pathnames "bar.abcl" sub1)) 57 (cl-fad-copy-file (merge-pathnames "bar.abcl") 58 (merge-pathnames "bar.abcl" sub2)) 55 59 (cl-fad-copy-file (merge-pathnames "eek.lisp") 56 (merge-pathnames "eek.lisp"dir))60 (merge-pathnames "eek.lisp" tmpdir)) 57 61 (cl-fad-copy-file (merge-pathnames "eek.lisp") 58 (merge-pathnames "eek.lisp" sub))62 (merge-pathnames "eek.lisp" sub1)) 59 63 (sys:zip (merge-pathnames "baz.jar") 60 (append 61 (directory (merge-pathnames "*" dir)) 62 (directory (merge-pathnames "*" sub))) 63 dir) 64 (delete-directory-and-files dir))) 64 (loop :for p :in (list tmpdir sub1 sub2) 65 :appending (directory (merge-pathnames "*" p))) 66 tmpdir) 67 #+nil (delete-directory-and-files dir))) 65 68 (setf *jar-file-init* t)) 66 69 … … 122 125 t) 123 126 127 (deftest jar-pathname.load.11 128 (with-jar-file-init 129 (load "jar:file:baz.jar!/d/e+f/bar.abcl")) 130 t) 131 124 132 ;;; wrapped in PROGN for easy disabling without a network connection 125 133 ;;; XXX come up with a better abstraction … … 132 140 133 141 (progn 134 (deftest jar-pathname.load. 11142 (deftest jar-pathname.load.http.1 135 143 (load-url-relative "foo") 136 144 t) 137 145 138 (deftest jar-pathname.load. 12146 (deftest jar-pathname.load.http.2 139 147 (load-url-relative "bar") 140 148 t) 141 149 142 (deftest jar-pathname.load. 13150 (deftest jar-pathname.load.http.3 143 151 (load-url-relative "bar.abcl") 144 152 t) 145 153 146 (deftest jar-pathname.load. 14154 (deftest jar-pathname.load.http.4 147 155 (load-url-relative "eek") 148 156 t) 149 157 150 (deftest jar-pathname.load. 15158 (deftest jar-pathname.load.http.5 151 159 (load-url-relative "eek.lisp") 152 160 t) 153 161 154 (deftest jar-pathname.load. 16162 (deftest jar-pathname.load.http.6 155 163 (load-url-relative "a/b/foo") 156 164 t) 157 165 158 (deftest jar-pathname.load. 17166 (deftest jar-pathname.load.http.7 159 167 (load-url-relative "a/b/bar") 160 168 t) 161 169 162 (deftest jar-pathname.load. 18170 (deftest jar-pathname.load.http.8 163 171 (load-url-relative "a/b/bar.abcl") 164 172 t) 165 173 166 (deftest jar-pathname.load. 19174 (deftest jar-pathname.load.http.9 167 175 (load-url-relative "a/b/eek") 168 176 t) 169 177 170 (deftest jar-pathname.load. 20178 (deftest jar-pathname.load.http.10 171 179 (load-url-relative "a/b/eek.lisp") 172 180 t)) … … 193 201 (with-jar-file-init 194 202 (probe-file "jar:file:baz.jar!/a/b")) 195 nil) 203 #p#.(format nil "jar:file:~Abaz.jar!/a/b/" 204 (namestring *abcl-test-directory*))) 196 205 197 206 (deftest jar-pathname.probe-file.5 … … 199 208 (probe-file "jar:file:baz.jar!/a/b/")) 200 209 #p#.(format nil "jar:file:~Abaz.jar!/a/b/" 210 (namestring *abcl-test-directory*))) 211 212 (deftest jar-pathname.probe-file.6 213 (with-jar-file-init 214 (probe-file "jar:file:baz.jar!/d/e+f/bar.abcl")) 215 #p#.(format nil "jar:file:~Abaz.jar!/d/e+f/bar.abcl" 201 216 (namestring *abcl-test-directory*))) 202 217 … … 327 342 (:absolute "c" "d") "foo" "lisp") 328 343 344 (deftest jar-pathname.10 345 (let ((s "jar:file:/foo/bar/a space/that!/this")) 346 (equal s 347 (namestring (pathname s)))) 348 t) 349 350 (deftest jar-pathname.11 351 (let ((s "jar:file:/foo/bar/a+space/that!/this")) 352 (equal s 353 (namestring (pathname s)))) 354 t) 355 356 329 357 (deftest jar-pathname.match-p.1 330 358 (pathname-match-p "jar:file:/a/b/some.jar!/a/system/def.asd" -
branches/0.23.x/abcl/test/lisp/abcl/pathname-tests.lisp
r13011 r13033 439 439 t) 440 440 441 #+windows 442 (deftest pathname.windows.6 443 (equal (pathname-device #p"z:/foo/bar") "z") 444 t) 445 446 #+windows 447 (deftest pathname.windows.7 448 (equal (pathname-device #p"file:z:/foo/bar") "z") 449 t) 450 451 #+windows 452 (deftest pathname.windows.8 453 (equal (pathname-device #p"zoo:/foo/bar") nil) 454 t) 455 441 456 (deftest wild.1 442 457 (check-physical-pathname #p"foo.*" nil "foo" :wild)
Note: See TracChangeset
for help on using the changeset viewer.