diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-10-25 20:31:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 23:26:58 +0100 |
commit | bf0c9c3becbe1f4e42a836f8564b62c18529ef55 (patch) | |
tree | ad7fb3c4aea7d74ef26542b398e1cdb693cc64da /config.tests | |
parent | 54c8c7a96a9303e7a56ca3cef8dcb1e91f23f2ac (diff) |
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>
Diffstat (limited to 'config.tests')
-rwxr-xr-x | config.tests/unix/makeabs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/config.tests/unix/makeabs b/config.tests/unix/makeabs index 4df26f769f..d2f65d19e9 100755 --- a/config.tests/unix/makeabs +++ b/config.tests/unix/makeabs @@ -15,13 +15,13 @@ elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then true else 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 +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 |