Bug fix: handling spaces in config files.

This commit is contained in:
LCD 47 2014-02-01 13:18:50 +02:00
parent b0126aa5a9
commit 147bd7cca3

View File

@ -30,7 +30,7 @@ function! syntastic#c#ReadConfig(file)
" try to read config file " try to read config file
try try
let lines = readfile(config) let lines = readfile(config)
catch /^Vim\%((\a\+)\)\=:E484/ catch /^Vim\%((\a\+)\)\=:E48[45]/
return '' return ''
endtry endtry
@ -43,13 +43,13 @@ function! syntastic#c#ReadConfig(file)
let parameters = [] let parameters = []
for line in lines for line in lines
let matches = matchlist(line, '\m\C^\s*-I\s*\(\S\+\)') let matches = matchstr(line, '\m\C^\s*-I\s*\zs.\+')
if matches != [] && matches[1] != '' if matches != ''
" this one looks like an absolute path " this one looks like an absolute path
if match(matches[1], '\m^\%(/\|\a:\)') != -1 if match(matches, '\m^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches[1]) call add(parameters, '-I' . matches)
else else
call add(parameters, '-I' . filepath . syntastic#util#Slash() . matches[1]) call add(parameters, '-I' . filepath . syntastic#util#Slash() . matches)
endif endif
else else
call add(parameters, line) call add(parameters, line)