Basic path substitution for g:syntastic_java_javac_custom_classpath_command

Allows '%FILE_PATH%', '%FILE_NAME%' and '%FILE_DIR%' to be used in the
Java custom classpath command to refer to the full file path, the file
basename, and the file directory, respectively.
This commit is contained in:
Ryan Turner 2015-06-24 18:12:30 -07:00
parent 56e19eb81a
commit 8269ba278d

View File

@ -129,7 +129,14 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" load custom classpath {{{2 " load custom classpath {{{2
if g:syntastic_java_javac_custom_classpath_command !=# '' if g:syntastic_java_javac_custom_classpath_command !=# ''
let lines = syntastic#util#system(g:syntastic_java_javac_custom_classpath_command) " Pre-process the classpath command string a little.
let classpath_command = g:syntastic_java_javac_custom_classpath_command
for sub in [['%FILE_PATH%', expand('%:p')],
\ ['%FILE_NAME%', expand('%:t')],
\ ['%FILE_DIR%', expand('%:p:h')]]
let classpath_command = substitute(classpath_command, sub[0], sub[1], 'g')
endfor
let lines = system(classpath_command)
if syntastic#util#isRunningWindows() || has('win32unix') if syntastic#util#isRunningWindows() || has('win32unix')
let lines = substitute(lines, "\r\n", "\n", 'g') let lines = substitute(lines, "\r\n", "\n", 'g')
endif endif