forked from SKCraft/Launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor JavaRuntimeFinder into subclasses & clean up
The getAvailableRuntimes function is now parseable, & the new PlatformRuntimeFinder interface makes it clear what each stage does.
- Loading branch information
1 parent
8c9f903
commit 0833563
Showing
16 changed files
with
461 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
launcher/src/main/java/com/skcraft/launcher/InstanceSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
260 changes: 0 additions & 260 deletions
260
launcher/src/main/java/com/skcraft/launcher/launch/JavaRuntimeFinder.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...craft/launcher/launch/AddJavaRuntime.java → ...uncher/launch/runtime/AddJavaRuntime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.skcraft.launcher.launch; | ||
package com.skcraft.launcher.launch.runtime; | ||
|
||
import java.io.File; | ||
|
||
|
47 changes: 47 additions & 0 deletions
47
launcher/src/main/java/com/skcraft/launcher/launch/runtime/JavaReleaseFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.skcraft.launcher.launch.runtime; | ||
|
||
import com.skcraft.launcher.util.EnvironmentParser; | ||
import lombok.extern.java.Log; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Map; | ||
import java.util.logging.Level; | ||
|
||
@Log | ||
public class JavaReleaseFile { | ||
private Map<String, String> backingMap; | ||
|
||
private JavaReleaseFile(Map<String, String> releaseDetails) { | ||
this.backingMap = releaseDetails; | ||
} | ||
|
||
public String getVersion() { | ||
return backingMap.get("JAVA_VERSION"); | ||
} | ||
|
||
public String getArch() { | ||
return backingMap.get("OS_ARCH"); | ||
} | ||
|
||
public boolean isArch64Bit() { | ||
return getArch() == null || getArch().matches("x64|x86_64|amd64|aarch64"); | ||
} | ||
|
||
public static JavaReleaseFile parseFromRelease(File javaPath) { | ||
File releaseFile = new File(javaPath, "release"); | ||
|
||
if (releaseFile.exists()) { | ||
try { | ||
Map<String, String> releaseDetails = EnvironmentParser.parse(releaseFile); | ||
|
||
return new JavaReleaseFile(releaseDetails); | ||
} catch (IOException e) { | ||
log.log(Level.WARNING, "Failed to read release file " + releaseFile.getAbsolutePath(), e); | ||
return null; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../skcraft/launcher/launch/JavaRuntime.java → .../launcher/launch/runtime/JavaRuntime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.