aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-28 01:02:42 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-03-28 01:49:36 +0200
commit6fbcbebae04af8e2f1b64f51049efbe49f771711 (patch)
tree3cd5d4f83e4a940697f1875fb5719c0728f2b03e
parent9d200cd0a3ef749509cee3331ba1d0b5fb62e7f2 (diff)
downloadrneovim-6fbcbebae04af8e2f1b64f51049efbe49f771711.tar.gz
rneovim-6fbcbebae04af8e2f1b64f51049efbe49f771711.tar.bz2
rneovim-6fbcbebae04af8e2f1b64f51049efbe49f771711.zip
win: health/provider.vim: check with `.exe` extension
Also fix `python_multiple` comparison.
-rw-r--r--runtime/autoload/health/provider.vim12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 57dd508f96..9f3f492ef6 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -8,6 +8,11 @@ function! s:trim(s) abort
return substitute(a:s, '^\_s*\|\_s*$', '', 'g')
endfunction
+" Convert '\' to '/'. Collapse '//' and '/./'.
+function! s:normalize_path(s) abort
+ return substitute(substitute(a:s, '\', '/', 'g'), '/\./\|/\+', '/', 'g')
+endfunction
+
" Simple version comparison.
function! s:version_cmp(a, b) abort
let a = split(a:a, '\.', 0)
@@ -208,7 +213,7 @@ endfunction
" Check the Python interpreter's usability.
function! s:check_bin(bin) abort
- if !filereadable(a:bin)
+ if !filereadable(a:bin) && (!has('win32') || !filereadable(a:bin.'.exe'))
call health#report_error(printf('"%s" was not found.', a:bin))
return 0
elseif executable(a:bin) != 1
@@ -287,8 +292,9 @@ function! s:check_python(version) abort
if exists('$PATH')
for path in split($PATH, has('win32') ? ';' : ':')
- let path_bin = path.'/'.pyname
- if path_bin != python_bin && index(python_multiple, path_bin) == -1
+ let path_bin = s:normalize_path(path.'/'.pyname)
+ if path_bin != s:normalize_path(python_bin)
+ \ && index(python_multiple, path_bin) == -1
\ && executable(path_bin)
call add(python_multiple, path_bin)
endif