From 7e2f12bb92bb801c66eea7f1d000a6e1161143d3 Mon Sep 17 00:00:00 2001 From: xudyang1 <61672396+xudyang1@users.noreply.github.com> Date: Sat, 20 Jan 2024 00:09:17 -0500 Subject: [PATCH] fix: remove incorrect WSL env variable (#1578) Variable `s:is_wsl` indicates whether firenvim is running on the WSL side or on the Windows host system. Currently, `s:is_wsl` checks three environment variables `$WSLENV`, `WSL_DISTRO_NAME`, and `WSL_INTEROP`. The following table lists the values of these env vars on the host system and on the WSL2 system: | ENV_VAR | Windows Host | WSL2 | |--------------------|-----------------------------|-----------------------------| | `$WSLENV` | `WT_SESSION:WT_PROFILE_ID:` | `WT_SESSION:WT_PROFILE_ID:` | | `$WSL_DISTRO_NAME` | empty | `Ubuntu-22.04` | | `$WSL_INTEROP` | empty | `/run/WSL/1133_interop` | The incorrect env var `$WSLENV` is used in https://github.com/glacambre/firenvim/blob/8c6c00aae7e5762cbcb4cd0df5848e959c4a9572/autoload/firenvim.vim#L921 As a result, `s:is_wsl` is set to `1` even when firenvim is installed from the host system, and thus directory `mnt/c/users/myusername/appdata/local/firenvim` is created under the `C:` drive. --- autoload/firenvim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/firenvim.vim b/autoload/firenvim.vim index 98b80164..de34d27f 100644 --- a/autoload/firenvim.vim +++ b/autoload/firenvim.vim @@ -918,7 +918,7 @@ function! firenvim#install(...) abort endfor if !s:is_wsl - let s:is_wsl = !empty($WSLENV) || !empty($WSL_DISTRO_NAME) || !empty ($WSL_INTEROP) + let s:is_wsl = !empty($WSL_DISTRO_NAME) || !empty ($WSL_INTEROP) if s:is_wsl echo 'Installation complete on the wsl side. Performing install on the windows side.' call firenvim#install(l:force_install, l:script_prolog)