Skip to content

Refresh launcher path/OS handling for current Minecraft binaries and Windows support#1

Open
Copilot wants to merge 3 commits intomainfrom
copilot/update-minecraft-game-band
Open

Refresh launcher path/OS handling for current Minecraft binaries and Windows support#1
Copilot wants to merge 3 commits intomainfrom
copilot/update-minecraft-game-band

Conversation

Copy link

Copilot AI commented Mar 4, 2026

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

    • Reworked OS-family detection to use resilient os.name matching (win/mac/linux) instead of first-token parsing.
    • Fixed switch fallthrough in BasicLauncher.start() so macOS no longer cascades into Windows execution.
    • Added explicit unsupported-OS failure paths and safer null handling for install/game directories.
  • Cross-platform path correctness

    • Removed leading separators from relative path fragments that were unintentionally creating absolute paths.
    • Normalized install/data path construction under Launchers/Official/... for both Windows and macOS.
    • Updated launcher binary resolution to build from install dir (Minecraft.exe, Contents/MacOS/launcher) instead of hardcoded string concatenation.
  • Download/install consistency with current binaries

    • Normalized download target filenames in DownloadURLs (no embedded path separators), aligning output names with OS-agnostic file creation behavior.
  • Runtime location + packaging alignment

    • Hardened MountPoint resolution via URI handling and correct parent resolution when running from a jar.
    • Corrected nativePackage main class from a stale class name to org.opengameband.Main.
  • Error propagation + docs

    • Extended LauncherFailiure with message/cause constructors to preserve context on failures.
    • Updated README status text to reflect Windows + macOS launcher support.
private String getOsFamily() {
    String os = System.getProperty("os.name", "").toLowerCase();
    if (os.contains("win")) return "Windows";
    if (os.contains("mac")) return "Mac";
    if (os.contains("linux")) return "Linux";
    return "Unknown";
}
Original prompt

Make it up-to-date and work with windows. This is supposed to be a replacement for the defunct version of the Minecraft game band, but this code hasn't been updated since 2022 get it working. There are other get hub repairs with the code on it.


🔒 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.

Copilot AI and others added 2 commits March 4, 2026 19:30
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
@TheCodingSoldier TheCodingSoldier marked this pull request as ready for review March 18, 2026 22:32
Copilot AI review requested due to automatic review settings March 18, 2026 22:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 current org.opengameband.Main class 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() invokes hdiutil via string concatenation ("hdiutil attach " + file). If file contains spaces (common when the app/jar lives under a path like Program Files or user directories), this will fail. Use ProcessBuilder (or Runtime.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");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants