Mercurial > hg > graal-jvmci-8
comparison mxtool/mx @ 18406:194041c3fdab
improve path resolving in mx.sh so that it can be run from outside the repo root
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 14 Nov 2014 13:49:12 +0100 |
parents | e82d22396109 |
children |
comparison
equal
deleted
inserted
replaced
18405:4a1b4400bb1f | 18406:194041c3fdab |
---|---|
26 # ---------------------------------------------------------------------------------------------------- | 26 # ---------------------------------------------------------------------------------------------------- |
27 | 27 |
28 dir=`/bin/pwd` | 28 dir=`/bin/pwd` |
29 | 29 |
30 # Resolve location of this script so that mx.py can be found in the same directory | 30 # Resolve location of this script so that mx.py can be found in the same directory |
31 source="${BASH_SOURCE[0]}" | 31 source="${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}" |
32 while [ -h "$source" ] ; do source="$(readlink "$source")"; done | 32 while [ -h "$source" ]; do |
33 dir="$( cd -P "$( dirname "$source" )" && pwd )" | 33 dir="$(cd -P "$(dirname "$source")" && pwd)" |
34 source="$(readlink "$source")" | |
35 [[ $source != /* ]] && source="$dir/$source" | |
36 done | |
37 dir="$(cd -P "$(dirname "$source")" && pwd)" | |
34 | 38 |
35 if [ ! -f "$dir/mx.py" ]; then | 39 if [ ! -f "$dir/mx.py" ]; then |
36 echo "Cannot find mx.py in $dir" | 40 echo "Cannot find mx.py in $dir" |
37 exit 1 | 41 exit 1 |
38 fi | 42 fi |