From f826d88aeb37337175f48f1f2c72ce4c5ece34c3 Mon Sep 17 00:00:00 2001 From: Jackjt8 Date: Mon, 18 Jan 2021 18:03:52 +0000 Subject: [PATCH 1/2] Fix module-path if javafxDir contains spaces Adds double quotes around javafxDir fixing issues with directories like `C:\Program Files\AdoptOpenJDK\jdk-11.0.9.11-hotspot\lib`. --- launcher/src/se/llbit/chunky/launcher/ChunkyLauncher.java | 2 +- launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher/src/se/llbit/chunky/launcher/ChunkyLauncher.java b/launcher/src/se/llbit/chunky/launcher/ChunkyLauncher.java index 91cff87ade..1d444279ba 100644 --- a/launcher/src/se/llbit/chunky/launcher/ChunkyLauncher.java +++ b/launcher/src/se/llbit/chunky/launcher/ChunkyLauncher.java @@ -58,7 +58,7 @@ */ public class ChunkyLauncher { - public static final String LAUNCHER_VERSION = "v1.12.0"; + public static final String LAUNCHER_VERSION = "v1.12.1"; /** * Print a launch error message to the console. diff --git a/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java b/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java index a3393dec45..048c49ff16 100644 --- a/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java +++ b/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java @@ -60,9 +60,9 @@ private static void runWithJavafx(Path javafxDir, String[] args) { // add the options again so the launcher can use them for chunky cmd.add("--javaOptions"); StringBuilder javaOptions = new StringBuilder(); - javaOptions.append("--module-path "); + javaOptions.append("--module-path \\\""); javaOptions.append(javafxDir.toAbsolutePath().toString()); - javaOptions.append(" --add-modules "); + javaOptions.append("\\\" --add-modules "); javaOptions.append("javafx.controls,javafx.fxml"); cmd.add(javaOptions.toString()); From b64368d503ee375c91b3accd0ada3a3a590c1d46 Mon Sep 17 00:00:00 2001 From: Jack Peters Date: Tue, 19 Jan 2021 23:04:06 +0000 Subject: [PATCH 2/2] Add comment --- launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java b/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java index 048c49ff16..0883810c1c 100644 --- a/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java +++ b/launcher/src/se/llbit/chunky/launcher/JavaFxLocator.java @@ -60,9 +60,10 @@ private static void runWithJavafx(Path javafxDir, String[] args) { // add the options again so the launcher can use them for chunky cmd.add("--javaOptions"); StringBuilder javaOptions = new StringBuilder(); - javaOptions.append("--module-path \\\""); - javaOptions.append(javafxDir.toAbsolutePath().toString()); - javaOptions.append("\\\" --add-modules "); + javaOptions.append("--module-path "); + // Escape the path twice to make the second launcher pass the options to Chunky retaining the double speechmarks (fixes paths with spaces) + javaOptions.append("\\\"" + javafxDir.toAbsolutePath().toString() + "\\\""); + javaOptions.append(" --add-modules "); javaOptions.append("javafx.controls,javafx.fxml"); cmd.add(javaOptions.toString());