Safety net: avoid suffixesadd interfering with findfile().
This commit is contained in:
parent
176e32ca4d
commit
31cba018b3
@ -21,7 +21,7 @@ function! syntastic#c#ReadConfig(file) abort " {{{2
|
|||||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
|
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
|
||||||
|
|
||||||
" search upwards from the current file's directory
|
" search upwards from the current file's directory
|
||||||
let config = findfile(a:file, escape(expand('%:p:h', 1), ' ') . ';')
|
let config = syntastic#util#findFileInParent(a:file, expand('%:p:h', 1))
|
||||||
if config ==# ''
|
if config ==# ''
|
||||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
|
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
|
||||||
return ''
|
return ''
|
||||||
|
@ -227,10 +227,18 @@ function! syntastic#util#bufIsActive(buffer) abort " {{{2
|
|||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
" start in directory a:where and walk up the parent folders until it finds a
|
" start in directory a:where and walk up the parent folders until it finds a
|
||||||
" file matching a:what; return path to that file; do NOT use this function if
|
" file named a:what; return path to that file
|
||||||
" a:what doesn't contain wildcards, use findfile(a:what, escape(a:where, ' ') . ';')
|
function! syntastic#util#findFileInParent(what, where) abort " {{{2
|
||||||
" instead
|
let old_suffixesadd = &suffixesadd
|
||||||
function! syntastic#util#findInParent(what, where) abort " {{{2
|
let &suffixesadd = ''
|
||||||
|
let file = findfile(a:what, escape(a:where, ' ') . ';')
|
||||||
|
let &suffixesadd = old_suffixesadd
|
||||||
|
return file
|
||||||
|
endfunction " }}}2
|
||||||
|
|
||||||
|
" start in directory a:where and walk up the parent folders until it finds a
|
||||||
|
" file matching a:what; return path to that file
|
||||||
|
function! syntastic#util#findGlobInParent(what, where) abort " {{{2
|
||||||
let here = fnamemodify(a:where, ':p')
|
let here = fnamemodify(a:where, ':p')
|
||||||
|
|
||||||
let root = syntastic#util#Slash()
|
let root = syntastic#util#Slash()
|
||||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||||||
lockvar! g:_SYNTASTIC_START
|
lockvar! g:_SYNTASTIC_START
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:_SYNTASTIC_VERSION = '3.6.0-109'
|
let g:_SYNTASTIC_VERSION = '3.6.0-110'
|
||||||
lockvar g:_SYNTASTIC_VERSION
|
lockvar g:_SYNTASTIC_VERSION
|
||||||
|
|
||||||
" Sanity checks {{{1
|
" Sanity checks {{{1
|
||||||
|
@ -23,7 +23,7 @@ if !exists('g:syntastic_pc_lint_config_file')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
|
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
|
||||||
let config = findfile(g:syntastic_pc_lint_config_file, escape(expand('%:p:h', 1), ' ') . ';')
|
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
|
||||||
call self.log('config =', config)
|
call self.log('config =', config)
|
||||||
|
|
||||||
" -hFs1 - show filename, add space after messages, try to make message 1 line
|
" -hFs1 - show filename, add space after messages, try to make message 1 line
|
||||||
|
@ -35,7 +35,7 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict
|
|||||||
|
|
||||||
let make_options = {}
|
let make_options = {}
|
||||||
let compile_command = 'elixir'
|
let compile_command = 'elixir'
|
||||||
let mix_file = findfile('mix.exs', escape(expand('%:p:h', 1), ' ') . ';')
|
let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1))
|
||||||
|
|
||||||
if filereadable(mix_file)
|
if filereadable(mix_file)
|
||||||
let compile_command = 'mix compile'
|
let compile_command = 'mix compile'
|
||||||
|
@ -24,7 +24,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
|
|||||||
elseif exists('g:vaxe_hxml')
|
elseif exists('g:vaxe_hxml')
|
||||||
let hxml = g:vaxe_hxml
|
let hxml = g:vaxe_hxml
|
||||||
else
|
else
|
||||||
let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h', 1))
|
let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1))
|
||||||
endif
|
endif
|
||||||
let hxml = fnamemodify(hxml, ':p')
|
let hxml = fnamemodify(hxml, ':p')
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ endfunction " }}}2
|
|||||||
|
|
||||||
function! s:GetMavenProperties() " {{{2
|
function! s:GetMavenProperties() " {{{2
|
||||||
let mvn_properties = {}
|
let mvn_properties = {}
|
||||||
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
|
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
|
||||||
if s:has_maven && filereadable(pom)
|
if s:has_maven && filereadable(pom)
|
||||||
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
|
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
|
||||||
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
||||||
@ -350,7 +350,7 @@ function! s:GetMavenProperties() " {{{2
|
|||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! s:GetMavenClasspath() " {{{2
|
function! s:GetMavenClasspath() " {{{2
|
||||||
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
|
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
|
||||||
if s:has_maven && filereadable(pom)
|
if s:has_maven && filereadable(pom)
|
||||||
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
|
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
|
||||||
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
||||||
@ -394,7 +394,7 @@ function! s:GetMavenClasspath() " {{{2
|
|||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! s:MavenOutputDirectory() " {{{2
|
function! s:MavenOutputDirectory() " {{{2
|
||||||
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
|
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
|
||||||
if s:has_maven && filereadable(pom)
|
if s:has_maven && filereadable(pom)
|
||||||
let mvn_properties = s:GetMavenProperties()
|
let mvn_properties = s:GetMavenProperties()
|
||||||
let output_dir = getcwd()
|
let output_dir = getcwd()
|
||||||
|
@ -29,7 +29,7 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_javascript_flow_GetLocList() dict
|
function! SyntaxCheckers_javascript_flow_GetLocList() dict
|
||||||
if findfile('.flowconfig', escape(expand('%:p:h', 1), ' ') . ';') ==# ''
|
if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# ''
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
|
|||||||
let srcdir = syntastic#util#var('rst_sphinx_source_dir')
|
let srcdir = syntastic#util#var('rst_sphinx_source_dir')
|
||||||
call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir)
|
call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir)
|
||||||
if srcdir == ''
|
if srcdir == ''
|
||||||
let config = findfile('conf.py', escape(expand('%:p:h', 1), ' ') . ';')
|
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
|
||||||
if config == '' || !filereadable(config)
|
if config == '' || !filereadable(config)
|
||||||
call self.log('conf.py file not found')
|
call self.log('conf.py file not found')
|
||||||
return []
|
return []
|
||||||
@ -41,7 +41,7 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
|
|||||||
let confdir = syntastic#util#var('rst_sphinx_config_dir')
|
let confdir = syntastic#util#var('rst_sphinx_config_dir')
|
||||||
call self.log('g:syntastic_rst_sphinx_config_dir =', confdir)
|
call self.log('g:syntastic_rst_sphinx_config_dir =', confdir)
|
||||||
if confdir == ''
|
if confdir == ''
|
||||||
let config = findfile('conf.py', escape(expand('%:p:h', 1), ' ') . ';')
|
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
|
||||||
let confdir = (config != '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
|
let confdir = (config != '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user