summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-13 01:11:39 -0700
committerPaul Phillips <paulp@improving.org>2012-05-13 01:14:11 -0700
commit4cd0253d0d461d01672334d240bc5249027f536b (patch)
treeff51265912e2bf8aeb267d66469dee7bec4d3ef8 /src/compiler
parentc5200ba0eac4058bb535cfa50a8a2a05691542e8 (diff)
downloadscala-4cd0253d0d461d01672334d240bc5249027f536b.tar.gz
scala-4cd0253d0d461d01672334d240bc5249027f536b.tar.bz2
scala-4cd0253d0d461d01672334d240bc5249027f536b.zip
Tweak to the runner to deal with the big bad world.
Relative symlinks which start with .. are then run with an absolute path. It's robustness city.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-unix.tmpl13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
index 599936f6f8..85bb5f2056 100644
--- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
@@ -9,10 +9,19 @@
##############################################################################
findScalaHome () {
- # see #2092
+ # see SI-2092
local SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
- ( cd -P "$( dirname "$SOURCE" )"/.. && pwd )
+ 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
}
execCommand () {
[[ -n $SCALA_RUNNER_DEBUG ]] && echo "" && for arg in "$@@"; do echo "$arg"; done && echo "";