From 281f40bad966ca85cb49094e006709254bac50c9 Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Sat, 28 Sep 2024 16:00:55 +0200 Subject: [PATCH] Fix # in user supplied program arguments being ignored Program arguments containing # need to be quoted to avoid the # character from being interpreted as the start of a line comment. --- .../java/net/neoforged/moddevgradle/internal/RunUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java b/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java index 1ff43d37..8dead3cf 100644 --- a/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java +++ b/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java @@ -59,7 +59,8 @@ private RunUtils() { public static String escapeJvmArg(String arg) { var escaped = arg.replace("\\", "\\\\").replace("\"", "\\\""); - if (escaped.contains(" ")) { + // # is used for line comments in arg files and should be quoted to avoid misinterpretation + if (escaped.contains(" ") || escaped.contains("#")) { return "\"" + escaped + "\""; } return escaped;