IO.scala doesnt handle relative file paths on windows correctly #111

Closed
harrah opened this Issue Jan 5, 2013 · 1 comment

Comments

Projects
None yet
1 participant
Owner

harrah commented Jan 5, 2013

I found that this line from a SBT configuration (on Windows):

"lazy val tagtree = RootProject(file("../TagTree"))"

blows up with this exception:

java.net.URISyntaxException: Illegal character in path at index 2: ..\TagTree
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.(Unknown Source)
at sbt.IO$.toURI(IO.scala:620)
at sbt.RootProject$.apply(Reference.scala:32)
at HeroscapeMk2$.tagtree(Build.scala:4)

The problems seems to be at IO.scala:620:

"def toURI(f: File): URI = if(f.isAbsolute) f.toURI else new URI(f.getPath)"

Unfortunately, on Windows, File.getPath() uses backslashes which are illegal in URIs:

scala> new java.io.File("../TagTree")
res0: java.io.File = ..\TagTree

scala> res0.getPath()
res1: java.lang.String = ..\TagTree

Owner

harrah commented Jan 5, 2013

IMPORTANT This project has moved to https://github.com/sbt/sbt. This issue still exists to avoid dead links, but GitHub limitations prevent the original issue from being correctly preserved here. Please see sbt/sbt#111 for the full issue and to comment.

@harrah harrah closed this Jan 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment