Aladdin - Scala Bugtracking
[#1206] project: distribution priority: low category: feature
submitter assigned to status date submitted
Nikolay Stephane open 2007-07-12 11:55:24.0
subject [contrib #682] cygwin support for Scala scripts in PATH
code
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")

what happened
no such file: /cygdrive/ ...
what expected Hello
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-07-12 12:06:31.0