summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-03-18 20:39:42 +0000
committerw0rp <devw0rp@gmail.com>2018-03-18 20:39:50 +0000
commit43e8f47e6e8c4fd3cc7ea161120c320b85813efd (patch)
treefae056d0f98b67b7709a54d81b7bd5e4153b8725
parent68b9399d4c4cdca8a29b5e6125d44779c52def81 (diff)
downloadale-43e8f47e6e8c4fd3cc7ea161120c320b85813efd.zip
#1431 Normalize paths when checking for temporary paths on Windows
-rw-r--r--autoload/ale/engine.vim3
-rw-r--r--autoload/ale/path.vim4
-rw-r--r--test/test_loclist_corrections.vader2
3 files changed, 3 insertions, 6 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 89169874..dd871c36 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -366,9 +366,6 @@ function! s:RemapItemTypes(type_map, loclist) abort
endfor
endfunction
-" Save the temporary directory so we can figure out if files are in it.
-let s:temp_dir = fnamemodify(tempname(), ':h')
-
function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
let l:bufnr_map = {}
let l:new_loclist = []
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index 16dabf21..91832b35 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -84,12 +84,12 @@ function! ale#path#IsAbsolute(filename) abort
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
endfunction
-let s:temp_dir = fnamemodify(tempname(), ':h')
+let s:temp_dir = ale#path#Simplify(fnamemodify(tempname(), ':h'))
" Given a filename, return 1 if the file represents some temporary file
" created by Vim.
function! ale#path#IsTempName(filename) abort
- return a:filename[:len(s:temp_dir) - 1] is# s:temp_dir
+ return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir
endfunction
" Given a base directory, which must not have a trailing slash, and a
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index 6224d608..46c7e272 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -324,7 +324,7 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
\ 'foobar',
\ [
\ {'text': 'a', 'lnum': 2, 'filename': b:temp_name},
- \ {'text': 'a', 'lnum': 3, 'filename': b:temp_name},
+ \ {'text': 'a', 'lnum': 3, 'filename': substitute(b:temp_name, '\\', '/', 'g')},
\ ],
\ )