I'm setting up Scala on my Windows machine, and trying to run it from Cygwin. I'm able to launch a REPL and execute commands, but when I tried to pre-load a file (-i
) I was told the file didn't exist:
$ scala -i /home/username/preload.scala
That file does not exist
Welcome to Scala version 2.11.2 (Java HotSpot(TM) Client VM, Java 1.7.0_02).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
Now, the file does exist in the terminal:
$ [ -f /home/username/preload.scala ] && echo EXISTS
EXISTS
But Scala can't find it. It turns out, Scala is using the Windows directory root, rather than Cygwin's:
scala> Files.newDirectoryStream(Paths.get("/")).asScala.foreach{println}
\$Recycle.Bin
\cygwin
\Documents and Settings
\Drivers
\Program Files
\Program Files (x86)
\ProgramData
\Recovery
\System Volume Information
\Users
\Windows
But now I'm at a bit of a loss. How can I tell the Scala REPL to use Cygwin paths, or conversely how can I configure Cygwin to properly launch Scala?
You can't.
Some cygwin conversion is done in the launcher script, for classpaths, but it doesn't do file arguments.
Consider scala file.scala and scala pkg.Main as ambiguous.
Edit: maybe it's worth a feature request, since, besides -i handling, you can try to detect file paths to convert (slashes and colons).
(This is the same condition from plain Java, of course.)