diff --git a/io/src/main/scala/sbt/io/IO.scala b/io/src/main/scala/sbt/io/IO.scala index 5c0e1146..69b9d40b 100644 --- a/io/src/main/scala/sbt/io/IO.scala +++ b/io/src/main/scala/sbt/io/IO.scala @@ -148,19 +148,16 @@ object IO { case "jar" => val path = url.getPath val end = path.indexOf('!') - new URL( + new URI( if (end == -1) path else path.substring(0, end) - ) + ).toURL case "jrt" => val path = url.getPath val end = path.indexOf('/', 1) - new URL( - "jrt", - null, - if (end == -1) path - else path.substring(0, end) - ) + new URI( + s"jrt://${if (end == -1) path else path.substring(0, end)}" + ).toURL case _ => url } ) diff --git a/io/src/main/scala/sbt/io/syntax.scala b/io/src/main/scala/sbt/io/syntax.scala index d25e5dc8..a23bb573 100644 --- a/io/src/main/scala/sbt/io/syntax.scala +++ b/io/src/main/scala/sbt/io/syntax.scala @@ -36,7 +36,7 @@ object syntax extends IOSyntax0 { def uri(s: String): URI = new URI(s) def file(s: String): File = new File(s) - def url(s: String): URL = new URL(s) + def url(s: String): URL = uri(s).toURL implicit def fileToRichFile(file: File): RichFile = new RichFile(file) implicit def filesToFinder(cc: Traversable[File]): PathFinder = PathFinder.strict(cc)