diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java index 5c4ce50ba7..1c9c79a078 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java @@ -264,6 +264,11 @@ public static void generateLaunchScript(Profile profile, String id, Consumer injecter : injecters) { injecter.accept(launcherHelper); @@ -273,6 +278,21 @@ public static void generateLaunchScript(Profile profile, String id, Consumer "bat"; + case MACOS -> "command"; + default -> "sh"; + }; + } + @SafeVarargs public static void launch(Profile profile, String id, Consumer... injecters) { if (!checkVersionForLaunching(profile, id)) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index f5896914cf..090a483e99 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -644,10 +644,10 @@ public void makeLaunchScript(Path scriptFile) throws IOException { boolean usePowerShell = "ps1".equals(scriptExtension); if (!usePowerShell) { - if (isWindows && !scriptExtension.equals("bat")) + if (isWindows && !scriptExtension.equalsIgnoreCase("bat")) throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'bat' or 'ps1' in Windows"); - else if (!isWindows && !(scriptExtension.equals("sh") || scriptExtension.equals("command"))) - throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'sh', 'ps1' or 'command' in macOS/Linux"); + else if (!isWindows && !(scriptExtension.equalsIgnoreCase("sh") || scriptExtension.equalsIgnoreCase("command") || scriptExtension.equalsIgnoreCase("bash"))) + throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'sh', 'bash', 'ps1' or 'command' in macOS/Linux"); } final Command commandLine = generateCommandLine(nativeFolder);