Properly quote and resolve msvcc.sh params (#596)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/msvcc.sh b/msvcc.sh
index 97facd6..7cfc509 100755
--- a/msvcc.sh
+++ b/msvcc.sh
@@ -165,24 +165,24 @@ do
shift 1
;;
-I)
- p=$(cygpath -m $2)
- args="$args -I$p"
- includes="$includes -I$p"
+ p=$(cygpath -ma "$2")
+ args="$args -I\"$p\""
+ includes="$includes -I\"$p\""
shift 2
;;
-I*)
- p=$(cygpath -m ${1#-I})
- args="$args -I$p"
- includes="$includes -I$p"
+ p=$(cygpath -ma "${1#-I}")
+ args="$args -I\"$p\""
+ includes="$includes -I\"$p\""
shift 1
;;
-L)
- p=$(cygpath -m $2)
+ p=$(cygpath -ma $2)
linkargs="$linkargs -LIBPATH:$p"
shift 2
;;
-L*)
- p=$(cygpath -m ${1#-L})
+ p=$(cygpath -ma ${1#-L})
linkargs="$linkargs -LIBPATH:$p"
shift 1
;;
@@ -256,12 +256,12 @@ do
shift 2
;;
*.S)
- src=$1
+ src="$(cygpath -ma $1)"
assembly="true"
shift 1
;;
*.c)
- args="$args $1"
+ args="$args $(cygpath -ma $1)"
shift 1
;;
*)
@@ -312,7 +312,7 @@ if [ -n "$assembly" ]; then
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
fi
- "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
+ eval "\"$cl\" -nologo -EP $includes $defines $src" > $ppsrc || exit $?
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
if [ $ml = "armasm" ]; then
args="-nologo -g -oldit $armasm_output $ppsrc -errorReport:prompt"