summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-03-26 22:23:11 -0700
committerGeorge Fraser <george@fivetran.com>2019-03-26 22:23:11 -0700
commit71533945fefd6e17e3080cdc8f7a09131f9d3e2a (patch)
tree369f0603d990c7aca3bbc5c1a1003c317a06ecaf /src/main
parent1a08b3120ce8285180ec42c9656040fc9981078c (diff)
parent2a1b095e32d5e1bfdb64803ce8b7c3d08f8b2b6f (diff)
downloadjava-language-server-71533945fefd6e17e3080cdc8f7a09131f9d3e2a.zip
Merge branch 'master' into pr/leighmcculloch/86
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/javacs/Lib.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/org/javacs/Lib.java b/src/main/java/org/javacs/Lib.java
index 61c5bc4..083e69c 100644
--- a/src/main/java/org/javacs/Lib.java
+++ b/src/main/java/org/javacs/Lib.java
@@ -3,18 +3,25 @@ package org.javacs;
import java.io.File;
import java.lang.System;
import java.util.Optional;
+import java.util.Arrays;
import java.nio.file.*;
class Lib {
static Optional<Path> srcZipPath() {
return Optional.ofNullable(System.getenv("JAVA_HOME"))
- .flatMap(home -> Optional.of(Paths.get(home).resolve("lib/src.zip")))
- .flatMap(path -> {
- if (path.toFile().exists()) {
- return Optional.of(path);
- } else {
- return Optional.empty();
+ .map(home -> {
+ return Arrays.asList(new Path[]{
+ Paths.get(home).resolve("lib/src.zip"),
+ Paths.get(home).resolve("src.zip"),
+ });
+ })
+ .flatMap(paths -> {
+ for (Path path : paths) {
+ if (path.toFile().exists()) {
+ return Optional.of(path);
+ }
}
+ return Optional.empty();
});
}