summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-01 17:36:47 +0100
committerw0rp <devw0rp@gmail.com>2017-10-01 17:36:47 +0100
commit5731616cd27c6000a0ee788611b9299eebb9cf7f (patch)
tree58dac95a1b1f074700868d02ebce96a2de2ff531 /autoload
parentc76f721b590c02f5b9a17927dc93474d5187f5ed (diff)
downloadale-5731616cd27c6000a0ee788611b9299eebb9cf7f.zip
Get the mcsc handler tests to pass on Windows
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/path.vim16
1 files changed, 12 insertions, 4 deletions
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index 0ba174c7..83f6e85d 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -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