qt5base-lts/config.tests/unix/makeabs
Ray Donnelly 7628e6ed1a Android: Handle '<DRIVELETTER>:' in makeabs for Windows usage.
Change-Id: I70de8fe9976a214d143b6174a5d7aebf8e79169b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-04-12 22:43:19 +02:00

28 lines
611 B
Bash
Executable File

#!/bin/sh
FILE="$1"
RES="$FILE"
CUT_ARG="-b1"
if [ `uname -s` = "QNX" ]; then
# QNX does not understand "-b1"
CUT_ARG="-c1"
fi
if [ `echo $FILE | cut $CUT_ARG` = "/" ]; then
true
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
echo $RES #return