diff options
author | George Fraser <george@fivetran.com> | 2019-03-26 22:13:52 -0700 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-03-26 22:13:52 -0700 |
commit | 2a1b095e32d5e1bfdb64803ce8b7c3d08f8b2b6f (patch) | |
tree | b924b6589f65085a4c4cc68322a63908420fcab4 | |
parent | eedfdaa1b85f6a19fc96601f89aed5b08af96c7f (diff) | |
parent | 08c64ab031d0c120eaa4d014c4f107f8a347d9c6 (diff) | |
download | java-language-server-2a1b095e32d5e1bfdb64803ce8b7c3d08f8b2b6f.zip |
Merge branch 'pr/leighmcculloch/87'
-rw-r--r-- | src/main/java/org/javacs/Lib.java | 19 |
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(); }); } |