11#! /bin/bash
22#
3- # Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+ # Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
44# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55#
66# This code is free software; you can redistribute it and/or modify it
@@ -145,11 +145,14 @@ function import_path() {
145145 fi
146146
147147 if [[ " $path " != " " ]]; then
148+ # Store current unix path
149+ unixpath=" $path "
148150 # Now turn it into a windows path
149151 winpath=" $( $PATHTOOL -w " $path " 2> /dev/null) "
150152 # If it fails, try again with an added .exe (needed on WSL)
151153 if [[ $? -ne 0 ]]; then
152- winpath=" $( $PATHTOOL -w " $path .exe" 2> /dev/null) "
154+ unixpath=" $unixpath .exe"
155+ winpath=" $( $PATHTOOL -w " $unixpath " 2> /dev/null) "
153156 fi
154157 if [[ $? -eq 0 ]]; then
155158 if [[ ! " $winpath " =~ ^" $ENVROOT " \\ .* $ ]] ; then
@@ -159,11 +162,11 @@ function import_path() {
159162 # This monster of a command uses the %~s support from cmd.exe to
160163 # reliably convert to short paths on all winenvs.
161164 shortpath=" $( $CMD /q /c for %I in \( " $winpath " \) do echo %~sI 2> /dev/null | tr -d \\ n\\ r)"
162- path =" $( $PATHTOOL -u " $shortpath " ) "
163- # Path is now unix style, based on short name
165+ unixpath =" $( $PATHTOOL -u " $shortpath " ) "
166+ # unixpath is based on short name
164167 fi
165168 # Make it lower case
166- path=" $( echo " $path " | tr [:upper:] [:lower:]) "
169+ path=" $( echo " $unixpath " | tr [:upper:] [:lower:]) "
167170 fi
168171 else
169172 # On WSL1, PATHTOOL will fail for files in envroot. If the unix path
0 commit comments