Mercurial > hg > graal-jvmci-8
diff 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 |
line wrap: on
line diff
--- a/mxtool/mx Tue Nov 18 11:03:39 2014 +0100 +++ b/mxtool/mx Fri Nov 14 13:49:12 2014 +0100 @@ -28,9 +28,13 @@ dir=`/bin/pwd` # Resolve location of this script so that mx.py can be found in the same directory -source="${BASH_SOURCE[0]}" -while [ -h "$source" ] ; do source="$(readlink "$source")"; done -dir="$( cd -P "$( dirname "$source" )" && pwd )" +source="${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}" +while [ -h "$source" ]; do + dir="$(cd -P "$(dirname "$source")" && pwd)" + source="$(readlink "$source")" + [[ $source != /* ]] && source="$dir/$source" +done +dir="$(cd -P "$(dirname "$source")" && pwd)" if [ ! -f "$dir/mx.py" ]; then echo "Cannot find mx.py in $dir"