summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-06-05 14:16:43 +0100
committerw0rp <devw0rp@gmail.com>2019-06-05 14:16:43 +0100
commit7b78f2b846e2f3443dcb2ceacee54eb99e37f040 (patch)
tree3173fbc32daa56a25fb3de28470fdcaf381e32c0 /autoload
parent381fff0e4c0c7c5057ed0d114169fac3a419ff85 (diff)
downloadale-7b78f2b846e2f3443dcb2ceacee54eb99e37f040.zip
Fix #2525 - Convert Windows paths in a Unix environment
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/path.vim11
1 files changed, 9 insertions, 2 deletions
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index 60d42eb5..84c26d0a 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -3,13 +3,20 @@
" simplify a path, and fix annoying issues with paths on Windows.
"
-" Forward slashes are changed to back slashes so path equality works better.
+" Forward slashes are changed to back slashes so path equality works better
+" on Windows. Back slashes are changed to forward slashes on Unix.
+"
+" Unix paths can technically contain back slashes, but in practice no path
+" should, and replacing back slashes with forward slashes makes linters work
+" in environments like MSYS.
"
" Paths starting with more than one forward slash are changed to only one
" forward slash, to prevent the paths being treated as special MSYS paths.
function! ale#path#Simplify(path) abort
if has('unix')
- return substitute(simplify(a:path), '^//\+', '/', 'g') " no-custom-checks
+ let l:unix_path = substitute(a:path, '\\', '/', 'g')
+
+ return substitute(simplify(l:unix_path), '^//\+', '/', 'g') " no-custom-checks
endif
let l:win_path = substitute(a:path, '/', '\\', 'g')