blob: 083e69cee3c98e087acdd257a8079a44216fcfbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
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"))
.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();
});
}
static final Optional<Path> SRC_ZIP = srcZipPath();
}
|