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

harrah opened this Issue Jan 5, 2013 · 1 comment


None yet
1 participant

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: Illegal character in path at index 2: ..\TagTree
at$ Source)
at$Parser.checkChars(Unknown Source)
at$Parser.parseHierarchical(Unknown Source)
at$Parser.parse(Unknown Source)
at 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"../TagTree")
res0: = ..\TagTree

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


harrah commented Jan 5, 2013

IMPORTANT This project has moved to 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