Skip to content

Commit

Permalink
Support reading jar file with space in the name.
Browse files Browse the repository at this point in the history
```scala
@ java.net.URI.create("jar:file:/C:/Program Files/Java/jdk1.8.0/jre/lib/resources.jar")
java.lang.IllegalArgumentException: Illegal character in opaque part at index 20: jar:file:/C:/Program Files/Java/jdk1.8.0/jre/lib/resources.jar
@ java.net.URI.create("jar:file:/C:/Program%20Files/Java/jdk1.8.0/jre/lib/resources.jar")
res2: java.net.URI = jar:file:/C:/Program%20Files/Java/jdk1.8.0/jre/lib/resources.jar
@ Paths.get("U A").toUri.getPath
res3: String = "/Users/ollie/dev/scalameta/U A"
@ Paths.get("U A").toUri.toString
res4: String = "file:///Users/ollie/dev/scalameta/U%20A"
```
  • Loading branch information
olafurpg committed Apr 7, 2018
1 parent 1495637 commit bb0b90f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/scala/tools/jardiff/IOUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object IOUtil {
if (index == -1) {
fileOrZip
} else {
val uri = URI.create("jar:file:" + Paths.get(fileOrZip.toString.substring(0, index + extSlash.length - 1)).toUri.getPath)
val uri = URI.create("jar:" + Paths.get(fileOrZip.toString.substring(0, index + extSlash.length - 1)).toUri.toString)
val jarEntry = fileOrZip.toString.substring(index + extSlash.length - 1)
val system = newFileSystem(uri, new util.HashMap[String, Any]())
system.getPath(jarEntry)
Expand Down

0 comments on commit bb0b90f

Please sign in to comment.