Convert CygWin paths to Windows native for CIPD.

Bug: 828981
Change-Id: Ibd4b31413bcdbbfe9bb1076334c892f1a30c768e
Reviewed-on: https://chromium-review.googlesource.com/996432
Commit-Queue: Brian White <bcwhite@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
changes/32/996432/3
Brian White 7 years ago committed by Commit Bot
parent a1df57cdc6
commit 361822cb2d

23
cipd

@ -6,6 +6,7 @@
set -e -o pipefail
CYGWIN=false
MYPATH=$(dirname "${BASH_SOURCE[0]}")
: ${CIPD_CLIENT_VER:=`cat $MYPATH/cipd_client_version`}
@ -16,7 +17,11 @@ case $UNAME in
linux)
PLAT=linux
;;
cygwin*|msys*|mingw*)
cygwin*)
PLAT=windows
CYGWIN=true
;;
msys*|mingw*)
PLAT=windows
;;
darwin)
@ -106,4 +111,20 @@ if ! "$CLIENT" selfupdate -version "$CIPD_CLIENT_VER" ; then
echo "" 1>&2
fi
# CygWin requires changing absolute paths to Windows form. Relative paths
# are typically okay as Windows generally accepts both forward and back
# slashes. This could possibly be constrained to only /tmp/ and /cygdrive/.
if $CYGWIN; then
args=("$@")
for i in `seq 2 $#`; do
arg="${@:$i:1}"
if [ "${arg:0:1}" == "/" ]; then
last=$((i-1))
next=$((i+1))
set -- "${@:1:$last}" `cygpath -w "$arg"` "${@:$next}"
fi
done
echo "$CLIENT" "${@}"
fi
exec "$CLIENT" "${@}"

Loading…
Cancel
Save