Fix some path issues, and get lsp dir tests passing on Windows

This commit is contained in:
w0rp
2017-09-09 18:39:56 +01:00
parent 8055a03067
commit b3a9a0e3e8
3 changed files with 25 additions and 15 deletions

View File

@@ -7,6 +7,18 @@ function! ale#path#Simplify(path) abort
return substitute(simplify(a:path), '^//\+', '/', 'g') " no-custom-checks
endfunction
" This function is mainly used for testing.
" Simplify() a path, and change forward slashes to back slashes on Windows.
function! ale#path#Winify(path) abort
let l:simplified_path = ale#path#Simplify(a:path)
if has('win32')
return substitute(l:simplified_path, '/', '\\', 'g')
endif
return l:simplified_path
endfunction
" Given a buffer and a filename, find the nearest file by searching upwards
" through the paths relative to the given buffer.
function! ale#path#FindNearestFile(buffer, filename) abort

View File

@@ -50,5 +50,5 @@ function! ale#test#SetFilename(path) abort
\ ? a:path
\ : l:dir . '/' . a:path
silent noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path))
silent noautocmd execute 'file ' . fnameescape(ale#path#Winify(l:full_path))
endfunction