From: Rudolf Polzer Date: Mon, 24 Oct 2016 17:53:51 +0000 (-0400) Subject: Instead of "cd .." hackery, find the path of ./all by looking at $0. X-Git-Tag: xonotic-v0.8.2~18 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=7cce522db16998cca1d914d6b81bb6e2de3a5240;p=xonotic%2Fxonotic.git Instead of "cd .." hackery, find the path of ./all by looking at $0. This only supports invoking ./all directly (not via $PATH or symlinks), but should already be a lot better than before. --- diff --git a/all b/all index 7d54d00c..a6e8ebb0 100755 --- a/all +++ b/all @@ -19,15 +19,20 @@ LF=" ESC="" d00=`pwd` -while ! [ -f ./all ]; do - if [ x"`pwd`" = x"/" ]; then +case "$0" in + /*/all) + export d0=${0%/all} + ;; + */all) + export d0=$d00/${0%/all} + ;; + *) $ECHO "Cannot find myself." $ECHO "Please run this script with the working directory inside a Xonotic checkout." - exit 1 - fi - cd .. -done -export d0=`pwd` + ;; +esac +cd "$d0" +d0=`pwd` SELF="$d0/all" # If we are on WINDOWS: