fix(gog): keep the closing quote on spaced task arguments that end in a backslash

This commit is contained in:
maxjivi05 committed 2026-12-01 18:32:06 -05:00
1 parent 334fc86b20
commit 133980c4d2
2 files changed
+3 -2

No files matched your search

@@ -48,7 +48,7 @@ object StoreLaunch {
if (sidecar.store != Store.ROCKSTAR) lines += "rem Written by DroidDeck for ${sidecar.store.label}: ${sidecar.title}. Steam's shortcut runs this file."
lines += "cd /d \"%~dp0$dir\""
for ((k, v) in sidecar.env) if (ENV_NAME.matches(k)) lines += "set \"$k=${v.replace("\"", "")}\""
val args = sidecar.args.joinToString(" ") { if (sidecar.store == Store.ROCKSTAR || sidecar.store == Store.GOG && it.any { c -> c in BATCH_META }) batchArg(it) else quoteArg(it) }
val args = sidecar.args.joinToString(" ") { if (sidecar.store == Store.ROCKSTAR || sidecar.store == Store.GOG && (it.any { c -> c in BATCH_META } || ' ' in it && it.endsWith('\\'))) batchArg(it) else quoteArg(it) }
val run = "\"%~dp0$exe\"" + (if (args.isNotEmpty()) " $args" else "")
if (sidecar.store == Store.EPIC || sidecar.store == Store.UBISOFT) {
lines += "set \"$ROOT_VAR=Z:\""
@@ -491,10 +491,11 @@ class GogGameExeTest {
fun taskArgumentsWithBatchCharactersStayOneArgument() {
withFolder { root ->
root.exe("dosbox/DOSBOX.EXE", 4096)
val sidecar = StoreGameSidecar(Store.GOG, "1", "Game", "dosbox/DOSBOX.EXE", args = listOf("-conf", "base&extra.conf", "-noconsole"))
val sidecar = StoreGameSidecar(Store.GOG, "1", "Game", "dosbox/DOSBOX.EXE", args = listOf("-conf", "base&extra.conf", "-noconsole", "-savedir", "C:\\My Saves\\", "-windowed"))
StoreLaunch.writeLauncher(root, sidecar)
val text = File(root, StoreLaunch.LAUNCHER).readText()
assertTrue(text.contains("-conf ^\"base^&extra.conf^\" -noconsole"))
assertTrue(text.contains("-savedir ^\"C:\\My Saves\\\\^\" -windowed"))
}
}
}