Start with a script test.scala
#! scala -savecompiled
!#
Console.println("Hello")
The script works from cygwin when the script's location is given explicitly in Windows format:-
$ ./test.scala
Hello
It doesn't work from cygwin when the script's location is in cygwin format:-
$ `pwd`/test.scala
no such file: /cygdrive/ ... /test.scala
This becomes a problem when the script is in the PATH:-
$ mv ./test.scala /usr/local/bin/test2.scala
$ which test2.scala
/usr/local/bin/test2.scala
$ test2.scala
no such file: /usr/local/bin/test2.scala
$ mv /usr/local/bin/test2.scala C:/WINDOWS/test3.scala
$ which test3.scala
/cygdrive/c/WINDOWS/test3.scala
$ test3.scala
no such file: /cygdrive/c/WINDOWS/test3.scala
We can use the following workaround but perhaps the workaround could instead be in the distributed bin/scala script or the Scala code it calls.
#! /bin/sh
case "$(uname)" in
CYGWIN*)
script="$(cygpath -w "$0")"
;;
*)
script="$0"
;;
esac
exec "${SCALA_HOME}/bin/scala" -savecompiled "$script" "$@"
!#
Console.println("Hello")
|