Skip to content

Commit e146527

Browse files
committed
win/code.sh: falback when wslpath not present
1 parent d9b87e8 commit e146527

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

resources/win32/bin/code.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@ APP_NAME="@@APPNAME@@"
77
QUALITY="@@QUALITY@@"
88
NAME="@@NAME@@"
99

10-
set -e
11-
1210
if grep -qi Microsoft /proc/version; then
1311
# in a wsl shell
1412
WIN_CODE_CMD=$(wslpath -w "$(dirname "$(realpath "$0")")/$APP_NAME.cmd")
15-
16-
WSL_EXT_ID="ms-vscode.remote-wsl"
17-
WSL_EXT_WLOC=$(cmd.exe /c "$WIN_CODE_CMD" --locate-extension $WSL_EXT_ID)
18-
if ! [ -z "$WSL_EXT_WLOC" ]; then
19-
# replace \r\n with \n in WSL_EXT_WLOC, get linux path for
20-
WSL_CODE=$(wslpath -u "${WSL_EXT_WLOC%%[[:cntrl:]]}")/scripts/wslCode.sh
21-
$WSL_CODE $COMMIT $QUALITY "$WIN_CODE_CMD" "$APP_NAME" "$@"
22-
exit $?
13+
if ! [ -z "$WIN_CODE_CMD" ]; then
14+
WSL_EXT_ID="ms-vscode.remote-wsl"
15+
WSL_EXT_WLOC=$(cmd.exe /c "$WIN_CODE_CMD" --locate-extension $WSL_EXT_ID)
16+
if ! [ -z "$WSL_EXT_WLOC" ]; then
17+
# replace \r\n with \n in WSL_EXT_WLOC, get linux path for
18+
WSL_CODE=$(wslpath -u "${WSL_EXT_WLOC%%[[:cntrl:]]}")/scripts/wslCode.sh
19+
$WSL_CODE $COMMIT $QUALITY "$WIN_CODE_CMD" "$APP_NAME" "$@"
20+
exit $?
21+
fi
2322
fi
2423
fi
2524

0 commit comments

Comments
 (0)