mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] JavaHelper Windows
This commit is contained in:
parent
736aa93106
commit
0cc47a7b06
3 changed files with 16 additions and 3 deletions
|
@ -177,8 +177,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
|
|||
authManager = new AuthManager(this);
|
||||
updatesManager = new UpdatesManager(this);
|
||||
RestoreResponse.registerProviders(this);
|
||||
//Generate or set new Certificate API
|
||||
certificateManager.orgName = config.projectName;
|
||||
|
||||
config.init(ReloadType.FULL);
|
||||
registerObject("launchServer", this);
|
||||
GarbageManager.registerNeedGC(sessionManager);
|
||||
|
|
|
@ -137,6 +137,20 @@ public static String getIP(SocketAddress address) {
|
|||
return ((InetSocketAddress) address).getAddress().getHostAddress();
|
||||
}
|
||||
|
||||
public static Path getRoot() {
|
||||
switch (JVMHelper.OS_TYPE) {
|
||||
case MUSTDIE: {
|
||||
String drive = System.getenv("SystemDrive");
|
||||
return Paths.get(drive);
|
||||
}
|
||||
case LINUX:
|
||||
case MACOSX: {
|
||||
return Paths.get("/");
|
||||
}
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public static byte[] getResourceBytes(String name) throws IOException {
|
||||
return read(getResourceURL(name));
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public static List<JavaVersion> findJava() {
|
|||
}
|
||||
}
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||
Path rootDrive = Paths.get(System.getProperty("java.home"));
|
||||
Path rootDrive = IOHelper.getRoot();
|
||||
try {
|
||||
trySearchJava(javaPaths, result, rootDrive.resolve("Program Files").resolve("Java"));
|
||||
trySearchJava(javaPaths, result, rootDrive.resolve("Program Files").resolve("AdoptOpenJDK"));
|
||||
|
|
Loading…
Reference in a new issue