Skip to content

Commit

Permalink
Bug fix: Correct wrong expansion order in xolox#misc#path#which()
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed May 19, 2013
1 parent ef20062 commit 2cad05a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion autoload/xolox/misc/compat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
" scripts breaks backwards compatibility. This enables my Vim plug-ins to fail
" early when they detect an incompatible version, instead of breaking at the
" worst possible moments :-).
let g:xolox#misc#compat#version = 5
let g:xolox#misc#compat#version = 6

" Remember the directory where the miscellaneous scripts are loaded from
" so the user knows which plug-in to update if incompatibilities arise.
Expand Down
29 changes: 13 additions & 16 deletions autoload/xolox/misc/path.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: April 28, 2013
" Last Change: May 19, 2013
" URL: http://peterodding.com/code/vim/misc/

let s:windows_compatible = has('win32') || has('win64')
Expand All @@ -11,21 +11,18 @@ function! xolox#misc#path#which(...) " {{{1
let extensions = s:windows_compatible ? split($PATHEXT, ';') : ['']
let matches = []
let checked = {}
for directory in split($PATH, s:windows_compatible ? ';' : ':')
let directory = xolox#misc#path#absolute(directory)
if !has_key(checked, directory)
if isdirectory(directory)
for program in a:000
for extension in extensions
let path = xolox#misc#path#merge(directory, program . extension)
if executable(path)
call add(matches, path)
endif
endfor
endfor
endif
let checked[directory] = 1
endif
for program in a:000
for extension in extensions
for directory in split($PATH, s:windows_compatible ? ';' : ':')
let directory = xolox#misc#path#absolute(directory)
if isdirectory(directory)
let path = xolox#misc#path#merge(directory, program . extension)
if executable(path)
call add(matches, path)
endif
endif
endfor
endfor
endfor
return matches
endfunction
Expand Down

0 comments on commit 2cad05a

Please sign in to comment.