Get the mcsc handler tests to pass on Windows

This commit is contained in:
w0rp
2017-10-01 17:36:47 +01:00
parent c76f721b59
commit 5731616cd2
2 changed files with 15 additions and 7 deletions

View File

@@ -9,14 +9,22 @@ 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 an additional 'add_drive' argument is given, the current drive letter
" will be prefixed to any absolute paths on Windows.
function! ale#path#Winify(path, ...) abort
let l:new_path = ale#path#Simplify(a:path)
if has('win32')
return substitute(l:simplified_path, '/', '\\', 'g')
let l:new_path = substitute(l:new_path, '/', '\\', 'g')
" Add a drive letter to \foo\bar paths, if needed.
if a:0 && a:1 is# 'add_drive' && l:new_path[:0] is# '\'
let l:new_path = fnamemodify('.', ':p')[:1] . l:new_path
endif
endif
return l:simplified_path
return l:new_path
endfunction
" Given a buffer and a filename, find the nearest file by searching upwards