From e05a04a939493e67e098b716896956dbc7fc7db6 Mon Sep 17 00:00:00 2001 From: mviereck Date: Wed, 19 Feb 2020 19:46:12 +0100 Subject: [PATCH] WSL: create symlink in WSL to cache folder in Windows user dir #225 --- x11docker | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/x11docker b/x11docker index dedd1869..3d7808e5 100755 --- a/x11docker +++ b/x11docker @@ -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 @@ -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