Skip to content

Commit

Permalink
avoid deprecated java.net.URL constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Mar 24, 2023
1 parent f035146 commit 7753d73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions io/src/main/scala/sbt/io/IO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,19 @@ 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(
new URI(
"jrt",
null,
if (end == -1) path
else path.substring(0, end)
)
).toURL
case _ => url
}
)
Expand Down
2 changes: 1 addition & 1 deletion io/src/main/scala/sbt/io/syntax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7753d73

Please sign in to comment.