Skip to content

Commit

Permalink
fix: add uninstall on host side from WSL (#1576)
Browse files Browse the repository at this point in the history
The uninstallation logic is similar to `firenvim#install`:
> At first, is_wsl is set to false, even on WSL. This lets us uninstall
firenvim on the wsl side.
> Then, we set is_wsl to true if we're on wsl and launch
firenvim#uninstall again, uninstalling things on the host side.
  • Loading branch information
xudyang1 authored and glacambre committed Jan 23, 2024
1 parent 471354b commit 525485c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions autoload/firenvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,12 @@ function! firenvim#install(...) abort
endfunction

" Removes files created by Firenvim during its installation process

" The uninstallation logic is similar to `firenvim#install`:
" > At first, is_wsl is set to false, even on WSL. This lets us uninstall
" firenvim on the wsl side.
" > Then, we set is_wsl to true if we're on wsl and launch
" firenvim#uninstall again, uninstalling things on the host side.
function! firenvim#uninstall() abort

let l:data_dir = s:get_data_dir_path()
Expand Down Expand Up @@ -965,6 +971,14 @@ function! firenvim#uninstall() abort
call delete(l:manifest_path)
echo 'Removed native manifest for ' . l:name . '.'
endfor

if !s:is_wsl
let s:is_wsl = !empty($WSL_DISTRO_NAME) || !empty ($WSL_INTEROP)
if s:is_wsl
echo 'Uninstallation complete on the wsl side. Performing uninstall on the windows side.'
call firenvim#uninstall()
endif
endif
endfunction

function! firenvim#onUIEnter(event) abort
Expand Down

0 comments on commit 525485c

Please sign in to comment.