Skip to content

Commit

Permalink
WSL1/WSL2: check both /mnt/c and /c for PATH #249
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed May 12, 2020
1 parent 8f817dc commit 04a75f7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -6249,17 +6249,16 @@ check_host() { # check host environment
Winsubpath="$(convertpath unix "$(cygpath.exe -w "/" | rmcr)" )"
Mobyvm="yes"
;;
WSL1)
Winsubmount="/mnt"
WSL1|WSL2)
command -v "/mnt/c/Windows/System32/cmd.exe" >/dev/null && Winsubmount="/mnt"
command -v "/c/Windows/System32/cmd.exe" >/dev/null && Winsubmount=""
grep -q "Windows" <<< "${PATH:-}" || export PATH="${PATH:-}:$Winsubmount/c/Windows/System32:$Winsubmount/c/Windows/System32/WindowsPowerShell/v1.0" # can miss after sudo in WSL
command -v "$Winsubmount/c/Windows/System32/cmd.exe" >/dev/null || error "$Winsubsystem: Could not find cmd.exe
in /mnt/c/Windows/System32 or /c/Windows/System32.
Do you have a different path to your Windows system partition?"
Winsubpath="$(convertpath unix "$(getwslpath)")"
Mobyvm="yes"
;;
WSL2)
Winsubmount=""
grep -q "Windows" <<< "${PATH:-}" || export PATH="${PATH:-}:$Winsubmount/c/Windows/System32:$Winsubmount/c/Windows/System32/WindowsPowerShell/v1.0" # can miss after sudo in WSL
Winsubpath="$(convertpath unix "$(getwslpath)")"
;;
esac
Winsubmount="${Winsubmount%/}"
Winsubpath="${Winsubpath%/}"
Expand All @@ -6268,7 +6267,7 @@ check_host() { # check host environment
[ -z "$Mobyvm" ] && Mobyvm="no"
case $Mobyvm in
yes)
command -v docker.exe >/dev/null || export PATH="$PATH:$(convertpath subsystem "C:/Program Files/docker"):$(convertpath subsystem "C:/Program Files/Docker/Docker/resources/bin")"
command -v docker.exe >/dev/null || export PATH="${PATH:-}:$(convertpath subsystem "C:/Program Files/docker"):$(convertpath subsystem "C:/Program Files/Docker/Docker/resources/bin")"
Dockerexe="docker.exe"
;;
no)
Expand Down

0 comments on commit 04a75f7

Please sign in to comment.