From 11af956c845ad5bd0cb600806f3f570f98a92fa6 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 15 Nov 2019 09:11:04 +0000 Subject: [PATCH] Fix Linux/MacOS issues --- src/main/java/net/fabricmc/loom/util/RunConfig.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/fabricmc/loom/util/RunConfig.java b/src/main/java/net/fabricmc/loom/util/RunConfig.java index ee66495..7363daf 100644 --- a/src/main/java/net/fabricmc/loom/util/RunConfig.java +++ b/src/main/java/net/fabricmc/loom/util/RunConfig.java @@ -106,7 +106,7 @@ public class RunConfig { default: runConfig.mainClass = "net.fabricmc.devlaunchinjector.Main"; runConfig.programArgs = ""; - runConfig.vmArgs = "-Dfabric.dli.config=\"" + extension.getDevLauncherConfig().getAbsolutePath() + "\" -Dfabric.dli.env=" + mode.toLowerCase(); + runConfig.vmArgs = "-Dfabric.dli.config=" + quoteIfNeeded(extension.getDevLauncherConfig().getAbsolutePath()) + " -Dfabric.dli.env=" + mode.toLowerCase(); break; } @@ -218,4 +218,12 @@ public class RunConfig { throw new RuntimeException("Failed to find mainclass"); } + + private static String quoteIfNeeded(String input) { + if (!input.contains(" ")) { + return input; + } + + return String.format("\"%s\"", input); + } }