summaryrefslogtreecommitdiff
path: root/ale_linters/java/javac.vim
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-03-06 10:39:32 +0000
committerGitHub <noreply@github.com>2019-03-06 10:39:32 +0000
commit6aef52f026117e49869080698e0e303d95e83a9a (patch)
tree708e7192c3ff522fe08f37d5d8351e84e4c34def /ale_linters/java/javac.vim
parentcf883aa5a8b9a8b6403732c4d094be6e65479ddd (diff)
parent4fc27f099bfe89be284f64838884d0357956420f (diff)
downloadale-6aef52f026117e49869080698e0e303d95e83a9a.zip
Merge pull request #2305 from campbellr/master
javac: Don't assume src/main/java always exists
Diffstat (limited to 'ale_linters/java/javac.vim')
-rw-r--r--ale_linters/java/javac.vim13
1 files changed, 6 insertions, 7 deletions
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim
index e903210d..50cabacd 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