From 4fc27f099bfe89be284f64838884d0357956420f Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Thu, 20 Dec 2018 15:37:31 -0700 Subject: javac: Don't assume src/main/java always exists Some projects I have only have src/test/java (no /src/main/java), which seemed to break some incorrect assumptions the linter had. --- ale_linters/java/javac.vim | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ale_linters/java') diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim index 2aa01b4f..18a26b77 100644 --- a/ale_linters/java/javac.vim +++ b/ale_linters/java/javac.vim @@ -55,15 +55,14 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort if isdirectory(l:jaxb_dir) call add(l:sp_dirs, l:jaxb_dir) endif + endif - " Automatically include the test directory, but only for test code. - if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java' - let l:test_dir = fnamemodify(l:src_dir, ':h:h:h') - \ . (has('win32') ? '\test\java\' : '/test/java/') + " Automatically include the test directory, but only for test code. + if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java' + let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'src/test/java') - if isdirectory(l:test_dir) - call add(l:sp_dirs, l:test_dir) - endif + if isdirectory(l:test_dir) + call add(l:sp_dirs, l:test_dir) endif endif -- cgit v1.2.3