Refresh launcher path/OS handling for current Minecraft binaries and Windows support#1
Open
Refresh launcher path/OS handling for current Minecraft binaries and Windows support#1
Conversation
Co-authored-by: TheCodingSoldier <257933801+TheCodingSoldier@users.noreply.github.com>
Co-authored-by: TheCodingSoldier <257933801+TheCodingSoldier@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update Minecraft game band code for Windows compatibility
Refresh launcher path/OS handling for current Minecraft binaries and Windows support
Mar 4, 2026
There was a problem hiding this comment.
Pull request overview
Updates the OpenGameband “official Minecraft launcher” integration to be more robust on modern OS/path layouts, with explicit Windows support and improved runtime packaging alignment.
Changes:
- Hardened mount-point resolution and normalized install/data path construction to avoid accidental absolute paths.
- Refreshed launcher start logic: resilient OS detection, fixed macOS switch fallthrough, added unsupported-OS failures, and safer install-dir checks.
- Aligned packaging entrypoint (
nativePackage) with the currentorg.opengameband.Mainclass and updated README status.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/opengameband/util/MountPoint.java | Uses URI-based code source resolution and returns parent dir when running from a jar. |
| src/main/java/org/opengameband/util/DownloadURLs.java | Removes leading path separators from download target “filenames”. |
| src/main/java/org/opengameband/launcher/BasicLauncher.java | Reworks OS detection, normalizes paths, fixes start switch behavior, and adds null handling. |
| src/main/java/org/opengameband/exceptions/LauncherFailiure.java | Adds message/cause constructors for better error propagation. |
| README.md | Updates status text to include Windows support. |
| build.gradle | Updates nativePackage main class to org.opengameband.Main. |
Comments suppressed due to low confidence (1)
src/main/java/org/opengameband/launcher/BasicLauncher.java:83
extract()invokeshdiutilvia string concatenation ("hdiutil attach " + file). Iffilecontains spaces (common when the app/jar lives under a path likeProgram Filesor user directories), this will fail. UseProcessBuilder(orRuntime.exec(String[])) with separate arguments so the path is passed correctly, and consider consuming stderr / waiting for the process to exit to avoid hanging reads.
case "Mac":
try {
Process p = Runtime.getRuntime().exec("hdiutil attach " + file);
byte[] inputBytes = p.getInputStream().readAllBytes();
String stdin = new String(inputBytes);
System.out.println(stdin);
System.out.println(stdin.substring(stdin.indexOf("/dev/disk")));
Thread.sleep(1000);
FileUtils.CopyDir(Paths.get("/Volumes/Minecraft/Minecraft.app"), getInstallDir().toPath());
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+18
to
+25
| try { | ||
| File codeSourceLocation = new File(MountPoint.class.getProtectionDomain().getCodeSource().getLocation().toURI()); | ||
| if (codeSourceLocation.isFile()) { | ||
| return codeSourceLocation.getParentFile(); | ||
| } | ||
| return codeSourceLocation; | ||
| } catch (URISyntaxException e) { | ||
| return new File(MountPoint.class.getProtectionDomain().getCodeSource().getLocation().getPath()); |
Comment on lines
+129
to
+130
| File[] installFiles = installDir == null ? null : installDir.listFiles(); | ||
| return installDir != null && installDir.exists() && installFiles != null && installFiles.length > 0; |
Comment on lines
+30
to
+45
| File installDir = getInstallDir(); | ||
| File gameDataDir = getGameDataDir(); | ||
| if (installDir == null || gameDataDir == null) { | ||
| throw new LauncherFailiure("Launcher directories are not available"); | ||
| } | ||
| try { | ||
| switch (System.getProperty("os.name").split(" ")[0]) { | ||
| switch (getOsFamily()) { | ||
| case "Mac": { | ||
| Runtime.getRuntime().exec(new String[]{GetMountPoint().getAbsolutePath() + "/Launchers/Official/Minecraft.app/Contents/MacOS/launcher", | ||
| Runtime.getRuntime().exec(new String[]{new File(installDir, "Contents/MacOS/launcher").getAbsolutePath(), | ||
| "--workDir", getGameDataDir().getAbsolutePath()}); | ||
| break; | ||
| } | ||
| case "Windows": { | ||
| Runtime.getRuntime().exec(new String[]{getInstallDir().getAbsolutePath() + "\\Minecraft.exe", | ||
| Runtime.getRuntime().exec(new String[]{new File(installDir, "Minecraft.exe").getAbsolutePath(), | ||
| "--workDir", getGameDataDir().getAbsolutePath()}); | ||
| break; |
Comment on lines
+30
to
+34
| File installDir = getInstallDir(); | ||
| File gameDataDir = getGameDataDir(); | ||
| if (installDir == null || gameDataDir == null) { | ||
| throw new LauncherFailiure("Launcher directories are not available"); | ||
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates OpenGameband from its 2022 launcher assumptions to current behavior, with explicit Windows compatibility improvements for the Minecraft launcher flow. The goal is to keep the replacement launcher operational across supported desktop OSes without broad refactors.
Launcher execution + OS detection
os.namematching (win/mac/linux) instead of first-token parsing.switchfallthrough inBasicLauncher.start()so macOS no longer cascades into Windows execution.Cross-platform path correctness
Launchers/Official/...for both Windows and macOS.Minecraft.exe,Contents/MacOS/launcher) instead of hardcoded string concatenation.Download/install consistency with current binaries
DownloadURLs(no embedded path separators), aligning output names with OS-agnostic file creation behavior.Runtime location + packaging alignment
MountPointresolution via URI handling and correct parent resolution when running from a jar.nativePackagemain class from a stale class name toorg.opengameband.Main.Error propagation + docs
LauncherFailiurewith message/cause constructors to preserve context on failures.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.