Fix DefaultLauncher (#2584)
This commit is contained in:
@@ -26,6 +26,7 @@ import org.jackhuang.hmcl.util.gson.UUIDTypeAdapter;
|
||||
import org.jackhuang.hmcl.util.io.FileUtils;
|
||||
import org.jackhuang.hmcl.util.io.IOUtils;
|
||||
import org.jackhuang.hmcl.util.io.Unzipper;
|
||||
import org.jackhuang.hmcl.util.platform.Bits;
|
||||
import org.jackhuang.hmcl.util.platform.*;
|
||||
import org.jackhuang.hmcl.util.versioning.VersionNumber;
|
||||
|
||||
@@ -557,7 +558,7 @@ public class DefaultLauncher extends Launcher {
|
||||
if (!FileUtils.makeFile(scriptFile))
|
||||
throw new IOException("Script file: " + scriptFile + " cannot be created.");
|
||||
|
||||
OutputStream outputStream = new FileOutputStream(scriptFile);
|
||||
try (OutputStream outputStream = Files.newOutputStream(scriptFile.toPath())) {
|
||||
Charset charset = StandardCharsets.UTF_8;
|
||||
|
||||
if (isWindows) {
|
||||
@@ -645,6 +646,7 @@ public class DefaultLauncher extends Launcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!scriptFile.setExecutable(true))
|
||||
throw new PermissionException();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user