summaryrefslogtreecommitdiff
path: root/erts/etc/win32
diff options
context:
space:
mode:
authorDan Gudmundsson <dgud@erlang.org>2020-06-11 12:02:28 +0200
committerDan Gudmundsson <dgud@erlang.org>2020-06-16 10:29:50 +0200
commit10fe8d43092a3c661648ca8e93c8088a6988d6f4 (patch)
treeb8797689e4f4be6b75174ea4e1dd8e5f0a918bd5 /erts/etc/win32
parentd687a6f130d6554728cc250b932bad50bb729502 (diff)
downloaderlang-10fe8d43092a3c661648ca8e93c8088a6988d6f4.tar.gz
Update w32_path for WSL
'wslpath' have changed in the latest release. When converting to windows paths 'wslpath' now always output absolute paths, and file/dir must exist otherwise it fails. Patch 'w32_path.sh' to handle this, also use that in 'erlc' instead of using wslpath directly. I'm keeping the other uses of 'wslpath' for now since it should be slightly faster, the build times are already to long.
Diffstat (limited to 'erts/etc/win32')
-rwxr-xr-xerts/etc/win32/wsl_tools/erlc6
-rwxr-xr-xerts/etc/win32/wsl_tools/w32_path.sh73
2 files changed, 64 insertions, 15 deletions
diff --git a/erts/etc/win32/wsl_tools/erlc b/erts/etc/win32/wsl_tools/erlc
index 956ac19abd..bca537f751 100755
--- a/erts/etc/win32/wsl_tools/erlc
+++ b/erts/etc/win32/wsl_tools/erlc
@@ -29,14 +29,14 @@ for x in "$@"; do
-I/*|-o/*)
y=`echo $x | sed 's,^-[Io]\(/.*\),\1,g'`;
z=`echo $x | sed 's,^-\([Io]\)\(/.*\),\1,g'`;
- MPATH=`wslpath -m $y`;
+ MPATH=`w32_path.sh -m $y`;
CMD="$CMD -$z$MPATH";;
-pa/*)
y=`echo $x | sed 's,^-pa\(/.*\),\1,g'`;
- MPATH=`wslpath -m $y`;
+ MPATH=`w32_path.sh -m $y`;
CMD="$CMD -pa $MPATH";;
/*)
- MPATH=`wslpath -m $x`;
+ MPATH=`w32_path.sh -m $x`;
CMD="$CMD \"$MPATH\"";;
# Needed for +'{preproc_flags,whatever}'
+{preproc_flags,*})
diff --git a/erts/etc/win32/wsl_tools/w32_path.sh b/erts/etc/win32/wsl_tools/w32_path.sh
index 55fbd76174..52bcddfe5b 100755
--- a/erts/etc/win32/wsl_tools/w32_path.sh
+++ b/erts/etc/win32/wsl_tools/w32_path.sh
@@ -41,6 +41,15 @@ if [ -z "$1" ]; then
exit 1;
fi
+case "$1" in
+ /*)
+ rel_input=false
+ ;;
+ *)
+ rel_input=true
+ ;;
+esac
+
if [ $UNIX = true ]; then
# cl.exe loses //// in the beginning which make dependencies fail
# and sometimes lowercases the path
@@ -55,16 +64,56 @@ if [ $UNIX = true ]; then
;;
esac
else
- case "$SEPARATOR" in
- slash)
- echo `wslpath -m $ABSOLUTE "$1"`;
- ;;
- backslash)
- echo `wslpath -w $ABSOLUTE "$1"`;
- ;;
- double)
- DOUBLE=`wslpath -w $ABSOLUTE "$1" | sed 's,\\\\,\\\\\\\\,g'`;
- echo $DOUBLE
- ;;
- esac
+ # wslpath have changed to always return absolute paths and
+ # ensure the file/dir exists before translation
+
+ if [ $rel_input = true -a "$ABSOLUTE" = "" ]; then
+ case "$SEPARATOR" in
+ slash)
+ echo $1
+ ;;
+ backslash)
+ echo "$1" | sed 's,/,\\,g'
+ ;;
+ double)
+ echo "$1" | sed 's,/,\\\\,g'
+ ;;
+ esac
+ exit 0
+ fi
+
+ # absolute input and/or absolute output
+
+ if [ -d "$1" ]; then
+ dir=$1;
+ case "$SEPARATOR" in
+ slash)
+ echo `wslpath -m $ABSOLUTE "$dir"`;
+ ;;
+ backslash)
+ echo `wslpath -w $ABSOLUTE "$dir"`;
+ ;;
+ double)
+ DOUBLE=`wslpath -w $ABSOLUTE "$dir" | sed 's,\\\\,\\\\\\\\,g'`;
+ echo $DOUBLE
+ ;;
+ esac
+ exit 0
+ else
+ dir=`dirname $1`
+ file=`basename $1`
+
+ case "$SEPARATOR" in
+ slash)
+ echo `wslpath -m $ABSOLUTE "$dir"`/$file;
+ ;;
+ backslash)
+ echo `wslpath -w $ABSOLUTE "$dir"`\\$file;
+ ;;
+ double)
+ DOUBLE=`wslpath -w $ABSOLUTE "$dir" | sed 's,\\\\,\\\\\\\\,g'`;
+ echo $DOUBLE\\\\$file
+ ;;
+ esac
+ fi
fi