mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-03-07 17:36:52 +08:00
parent
46a7269087
commit
e7d5faeeac
@ -9,6 +9,7 @@ import org.jackhuang.hmcl.util.platform.JavaVersion;
|
|||||||
import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.DirectoryStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -45,12 +46,14 @@ public final class JavaRepository {
|
|||||||
String platform = platformOptional.get();
|
String platform = platformOptional.get();
|
||||||
Path javaStoragePath = getJavaStoragePath();
|
Path javaStoragePath = getJavaStoragePath();
|
||||||
if (Files.isDirectory(javaStoragePath)) {
|
if (Files.isDirectory(javaStoragePath)) {
|
||||||
for (Path component : Files.newDirectoryStream(javaStoragePath)) {
|
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(javaStoragePath)) {
|
||||||
Path javaHome = component.resolve(platform).resolve(component.getFileName());
|
for (Path component : dirStream) {
|
||||||
try {
|
Path javaHome = component.resolve(platform).resolve(component.getFileName());
|
||||||
addJava(javaHome);
|
try {
|
||||||
} catch (IOException e) {
|
addJava(javaHome);
|
||||||
LOG.log(Level.WARNING, "Failed to determine Java at " + javaHome, e);
|
} catch (IOException e) {
|
||||||
|
LOG.log(Level.WARNING, "Failed to determine Java at " + javaHome, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user