Skip to content

Commit

Permalink
WSL: create symlink in WSL to cache folder in Windows user dir #225
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Feb 19, 2020
1 parent b94f0c2 commit e05a04a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -6082,23 +6082,23 @@ check_host() { # check host environment
case $Winsubsystem in
MSYS2|CYGWIN)
Winsubmount="$(cygpath.exe -u "c:/" | rmcr | sed s%/c/%%)"
Winsubmount="${Winsubmount%/}"
Winsubpath="$(convertpath unix "$(cygpath.exe -w "/" | rmcr)" )"
Mobyvm="yes"
Mobyvm="yes"
;;
WSL1)
Winsubmount="/mnt"
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)")"
Mobyvm="yes"
Mobyvm="yes"
;;
WSL2)
Winsubmount="/"
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
[ "$Winsubsystem" ] && Hostsystem="MSWindows-$Winsubsystem"
Winsubmount="${Winsubmount%/}"

[ -z "$Mobyvm" ] && Mobyvm="no"
case $Mobyvm in
Expand Down Expand Up @@ -7111,8 +7111,14 @@ create_cachefiles() { # create empty cache files owned by unprivileged
""|MSYS2|CYGWIN) Cachebasefolder="$Hostuserhome/.cache/x11docker" ;;
WSL1|WSL2)
case $Mobyvm in
yes) Cachebasefolder="$(convertpath subsystem "$(wincmd "echo %userprofile%")")/x11docker/cache" ;;
no) Cachebasefolder="$Hostuserhome/.cache/x11docker" ;;
yes)
Cachebasefolder="$(convertpath subsystem "$(wincmd "echo %userprofile%")")/x11docker/cache"
mkdir -p "$Hostuserhome/.cache/x11docker/symlink"
ln -s -f -T "$Cachebasefolder" "$Hostuserhome/.cache/x11docker/symlink"
;;
no)
Cachebasefolder="$Hostuserhome/.cache/x11docker"
;;
esac
;;
esac
Expand Down

0 comments on commit e05a04a

Please sign in to comment.