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 51f4049b8..648e70171 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -541,9 +541,6 @@ public class DefaultLauncher extends Launcher { throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'sh' or 'ps1' in macOS/Linux"); } - if (!FileUtils.makeFile(scriptFile)) - throw new IOException("Script file: " + scriptFile + " cannot be created."); - final Command commandLine = generateCommandLine(nativeFolder); final String command = usePowerShell ? null : commandLine.commandLine.toString(); @@ -553,6 +550,9 @@ public class DefaultLauncher extends Launcher { } } + if (!FileUtils.makeFile(scriptFile)) + throw new IOException("Script file: " + scriptFile + " cannot be created."); + OutputStream outputStream = new FileOutputStream(scriptFile); Charset charset = StandardCharsets.UTF_8;