Skip to content

Commit

Permalink
chmod
Browse files Browse the repository at this point in the history
  • Loading branch information
cubewhy committed Jan 18, 2024
1 parent b71be15 commit 5cd5319
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/cubewhy/celestial/Celestial.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,20 @@ public static void initTheme() throws IOException {
public static ProcessBuilder launch() throws IOException {
// wrapper was applied in the script
log.info("Launching with script");
log.info("delete the log file");
gameLogFile.delete();
if (OSEnum.getCurrent().equals(OSEnum.Windows)) {
// Windows
// delete the log file
log.info("delete the log file");
gameLogFile.delete();
ProcessBuilder builder = new ProcessBuilder();
builder.command(System.getenv("WINDIR") + "/System32/cmd.exe", "/C \"" + launchScript.getPath() + String.format(" 1>>\"%s\" 2>&1\"", gameLogFile.getPath()));
return builder;
} else {
// others
// do chmod
Runtime.getRuntime().exec("chmod 777 " + launchScript.getPath());
ProcessBuilder builder = new ProcessBuilder();
builder.command("/bin/bash", "\"" + launchScript.getPath() + "\"");
builder.command("/bin/bash", "-c", "\"" + launchScript.getPath() + "\" > \"" + gameLogFile.getPath() + "\"");
return builder;
}
}
Expand Down

0 comments on commit 5cd5319

Please sign in to comment.