Skip to content

Commit

Permalink
Use wslpath command line tool when computing windows paths on WSL
Browse files Browse the repository at this point in the history
Closes #1481
  • Loading branch information
glacambre committed Jan 2, 2023
1 parent 17a189f commit c9cab43
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autoload/firenvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ function! s:to_wsl_path(path) abort
if a:path[0] ==# '/'
return a:path
endif
if executable('wslpath')
try
" 0:-2 because we need to remove the \r\n
return system(['wslpath', '-a', '-u', a:path])[0:-2]
catch
endtry
endif
let l:path_components = split(a:path, '\\')
return join(['/mnt', tolower(path_components[0][0:-2])] + l:path_components[1:-1], '/')
endfunction
Expand Down

0 comments on commit c9cab43

Please sign in to comment.