summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-09-09 18:39:56 +0100
committerw0rp <devw0rp@gmail.com>2017-09-09 18:39:56 +0100
commitb3a9a0e3e8264cf8ce7c4d3780b06ab62d0db287 (patch)
treeef57b5443c4e691245ff502575b898e0162005c6 /autoload
parent8055a03067a64aa9b194ac3e2429e6f2b10b1814 (diff)
downloadale-b3a9a0e3e8264cf8ce7c4d3780b06ab62d0db287.zip
Fix some path issues, and get lsp dir tests passing on Windows
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/path.vim12
-rw-r--r--autoload/ale/test.vim2
2 files changed, 13 insertions, 1 deletions
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index bc026cc2..7ad34b58 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -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
diff --git a/autoload/ale/test.vim b/autoload/ale/test.vim
index c0458053..346786c7 100644
--- a/autoload/ale/test.vim
+++ b/autoload/ale/test.vim
@@ -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