summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/path.vim16
-rw-r--r--test/handler/test_mcsc_handler.vader6
2 files changed, 15 insertions, 7 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
diff --git a/test/handler/test_mcsc_handler.vader b/test/handler/test_mcsc_handler.vader
index a65185ca..5f4c133c 100644
--- a/test/handler/test_mcsc_handler.vader
+++ b/test/handler/test_mcsc_handler.vader
@@ -19,21 +19,21 @@ Execute(The mcs handler should handle cannot find symbol errors):
\ 'col' : 29,
\ 'text': 'error CS1001: ; expected',
\ 'type': 'E',
- \ 'filename': '/home/foo/project/bar/Test.cs'
+ \ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 101,
\ 'col': 0,
\ 'text': 'error CS1028: Unexpected processor directive (no #if for this #endif)',
\ 'type': 'E',
- \ 'filename': '/home/foo/project/bar/Test.cs'
+ \ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 10,
\ 'col': 12,
\ 'text': 'warning CS0123: some warning',
\ 'type': 'W',
- \ 'filename': '/home/foo/project/bar/Test.cs'
+ \ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ ],
\ ale_linters#cs#mcsc#Handle(347, [