turn makeabs into a proper cleanPath()
normalize away all ".." and ".". fewer surprises that way. Change-Id: Iaa56c634aed5c8351966eaea7a73b85cb8235ead Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
54c8c7a96a
commit
bf0c9c3bec
@ -15,13 +15,13 @@ elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then
|
|||||||
true
|
true
|
||||||
else
|
else
|
||||||
RES="$PWD/$FILE"
|
RES="$PWD/$FILE"
|
||||||
test -d "$RES" && RES="$RES/"
|
|
||||||
RES=`echo "$RES" | sed "s,/\(\./\)*,/,g"`
|
|
||||||
|
|
||||||
# note: this will only strip 1 /path/../ from RES, i.e. given /a/b/c/../../../, it returns /a/b/../../
|
|
||||||
RES=`echo "$RES" | sed "s,\(/[^/]*/\)\.\./,/,g"`
|
|
||||||
|
|
||||||
RES=`echo "$RES" | sed "s,//,/,g" | sed "s,/$,,"`
|
|
||||||
fi
|
fi
|
||||||
|
RES=$RES/
|
||||||
|
while true; do
|
||||||
|
nres=`echo "$RES" | sed "s,/[^/][^/]*/\.\./,/,g; s,/\./,/,g"`
|
||||||
|
test x"$nres" = x"$RES" && break
|
||||||
|
RES=$nres
|
||||||
|
done
|
||||||
|
RES=`echo "$RES" | sed "s,//,/,g; s,/$,,"`
|
||||||
echo $RES #return
|
echo $RES #return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user