#1431 Normalize paths when checking for temporary paths on Windows

This commit is contained in:
w0rp 2018-03-18 20:39:42 +00:00
parent 68b9399d4c
commit 43e8f47e6e
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
3 changed files with 3 additions and 6 deletions

View File

@ -366,9 +366,6 @@ function! s:RemapItemTypes(type_map, loclist) abort
endfor endfor
endfunction 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 function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
let l:bufnr_map = {} let l:bufnr_map = {}
let l:new_loclist = [] let l:new_loclist = []

View File

@ -84,12 +84,12 @@ function! ale#path#IsAbsolute(filename) abort
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\' return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
endfunction 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 " Given a filename, return 1 if the file represents some temporary file
" created by Vim. " created by Vim.
function! ale#path#IsTempName(filename) abort 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 endfunction
" Given a base directory, which must not have a trailing slash, and a " Given a base directory, which must not have a trailing slash, and a

View File

@ -324,7 +324,7 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
\ 'foobar', \ 'foobar',
\ [ \ [
\ {'text': 'a', 'lnum': 2, 'filename': b:temp_name}, \ {'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')},
\ ], \ ],
\ ) \ )