Changeset 13026
- Timestamp:
- 11/17/10 15:55:47 (13 years ago)
- Location:
- trunk/abcl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Pathname.java
r13024 r13026 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 // But rencode \SPACE as '+' 203 s = s.replace(' ', '+'); 204 } catch (java.io.UnsupportedEncodingException uee) { 205 // Can't happen: every Java is supposed to support 206 // at least UTF-8 encoding 207 Debug.assertTrue(false); 208 s = null; 209 } 199 String s = url.getPath(); 210 200 if (s != null) { 211 212 213 201 if (Utilities.isPlatformWindows) { 202 // Workaround for Java's idea of URLs 203 // new (URL"file:///c:/a/b").getPath() --> "/c:/a/b" 214 204 // whereas we need "c" to be the DEVICE. 215 216 217 218 219 220 205 if (s.length() > 2 206 && s.charAt(0) == '/' 207 && s.charAt(2) == ':') { 208 s = s.substring(1); 209 } 210 } 221 211 init(s); 222 212 return; … … 654 644 if (type instanceof AbstractString) { 655 645 String t = type.getStringValue(); 656 657 658 659 660 661 662 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 } 663 653 sb.append(t); 664 654 } else if (type == Keyword.WILD) { … … 2107 2097 } else { 2108 2098 ZipEntry entry = jarFile.getEntry(entryPath); 2109 2110 2111 2099 if (entry == null) { 2100 Debug.trace("Failed to get InputStream for " 2101 + "'" + getNamestring() + "'"); 2112 2102 // XXX should this be fatal? 2113 2114 2103 Debug.assertTrue(false); 2104 } 2115 2105 try { 2116 2106 result = jarFile.getInputStream(entry); … … 2281 2271 if (Utilities.isPlatformWindows) { 2282 2272 if (destination.isFile()) { 2283 2273 ZipCache.remove(destination); 2284 2274 destination.delete(); 2285 2275 } … … 2341 2331 2342 2332 public URL toURL() throws MalformedURLException { 2343 2344 2345 2346 2347 2333 if(isURL()) { 2334 return new URL(getNamestring()); 2335 } else { 2336 return toFile().toURL(); 2337 } 2348 2338 } 2349 2339 2350 2340 public File toFile() { 2351 2352 2353 2354 2355 2341 if(!isURL()) { 2342 return new File(getNamestring()); 2343 } else { 2344 throw new RuntimeException(this + " does not represent a file"); 2345 } 2356 2346 } 2357 2347 -
trunk/abcl/test/lisp/abcl/jar-pathname.lisp
r13024 r13026 342 342 (:absolute "c" "d") "foo" "lisp") 343 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 344 357 (deftest jar-pathname.match-p.1 345 358 (pathname-match-p "jar:file:/a/b/some.jar!/a/system/def.asd" -
trunk/abcl/test/lisp/abcl/pathname-tests.lisp
r13011 r13026 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.