summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-03 05:34:49 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-03 05:34:49 -0700
commit488ed391e3572a621d7692c604fad464346091a5 (patch)
treed506026a9dad88915b769985c07f2673e25b4d8b /src/compiler
parent0f98979e6fe128d931c0458a71002f7548ce3907 (diff)
parented6daea665eccad2ab5394c0a5c36069aaf9a81f (diff)
downloadscala-488ed391e3572a621d7692c604fad464346091a5.tar.gz
scala-488ed391e3572a621d7692c604fad464346091a5.tar.bz2
scala-488ed391e3572a621d7692c604fad464346091a5.zip
Merge pull request #648 from pvlugter/issue/5792
More robust findScalaHome in bash scripts
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-unix.tmpl21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
index 85bb5f2056..256b5088e9 100644
--- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
@@ -9,19 +9,14 @@
##############################################################################
findScalaHome () {
- # see SI-2092
- local SOURCE="${BASH_SOURCE[0]}"
- while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
- local bindir="$( dirname "$SOURCE" )"
- if [[ -d "$bindir"/.. ]]; then
- ( cd -P "$bindir"/.. && pwd )
- else
- # See SI-5792
- local dir=$(dirname "${BASH_SOURCE[0]}")
- local link=$(dirname "$(readlink "${BASH_SOURCE[0]}")")
- local path="$dir/$link/.."
- ( cd "$path" && pwd )
- fi
+ # see SI-2092 and SI-5792
+ local source="${BASH_SOURCE[0]}"
+ while [ -h "$source" ] ; do
+ local linked="$(readlink "$source")"
+ local dir="$( cd -P $(dirname "$source") && cd -P $(dirname "$linked") && pwd )"
+ source="$dir/$(basename "$linked")"
+ done
+ ( cd -P "$(dirname "$source")/.." && pwd )
}
execCommand () {
[[ -n $SCALA_RUNNER_DEBUG ]] && echo "" && for arg in "$@@"; do echo "$arg"; done && echo "";