Debug: if reading a config file fails, log the reason it failed.

This commit is contained in:
LCD 47 2015-01-04 08:46:08 +02:00
parent b340672bd0
commit 79b04bdf43

View File

@ -18,9 +18,17 @@ endfunction " }}}2
" read additional compiler flags from the given configuration file " read additional compiler flags from the given configuration file
" the file format and its parsing mechanism is inspired by clang_complete " the file format and its parsing mechanism is inspired by clang_complete
function! syntastic#c#ReadConfig(file) " {{{2 function! syntastic#c#ReadConfig(file) " {{{2
" search in the current file's directory upwards call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
" search upwards from the current file's directory
let config = findfile(a:file, '.;') let config = findfile(a:file, '.;')
if config == '' || !filereadable(config) if config == ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
return ''
endif
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: config file:', config)
if !filereadable(config)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file unreadable')
return '' return ''
endif endif
@ -31,6 +39,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
try try
let lines = readfile(config) let lines = readfile(config)
catch /\m^Vim\%((\a\+)\)\=:E48[45]/ catch /\m^Vim\%((\a\+)\)\=:E48[45]/
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: error reading file')
return '' return ''
endtry endtry