aboutsummaryrefslogtreecommitdiff
path: root/client/system/cli.gd
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2025-09-21 17:54:32 +0200
committertpart <tpart120@proton.me>2025-09-21 17:54:32 +0200
commit49cb601d1dfceb7dc717fd3a231486db757d923d (patch)
tree50a3be9dab6d4a0cf1260ffb664f199d02c91702 /client/system/cli.gd
parentfac1f9548120368303a5d6e652b920f1b6400e42 (diff)
downloadhurrycurry-49cb601d1dfceb7dc717fd3a231486db757d923d.tar
hurrycurry-49cb601d1dfceb7dc717fd3a231486db757d923d.tar.bz2
hurrycurry-49cb601d1dfceb7dc717fd3a231486db757d923d.tar.zst
Trim apostrophes from command line arguments when running in editor
Diffstat (limited to 'client/system/cli.gd')
-rw-r--r--client/system/cli.gd11
1 files changed, 9 insertions, 2 deletions
diff --git a/client/system/cli.gd b/client/system/cli.gd
index efaa309a..7a312127 100644
--- a/client/system/cli.gd
+++ b/client/system/cli.gd
@@ -95,7 +95,7 @@ static func _parse_opt(args: Array[String], opt: Option) -> bool:
if args.is_empty():
push_error("missing option value")
return false
- opts[opt.long] = args[0]
+ opts[opt.long] = trim_apostrophes(args[0])
args.remove_at(0)
return true
Mode.MULTI_OPTION:
@@ -103,7 +103,7 @@ static func _parse_opt(args: Array[String], opt: Option) -> bool:
push_error("missing option value")
return false
if not opts.has(opt.long): opts[opt.long] = []
- opts[opt.long].push_back(args[0])
+ opts[opt.long].push_back(trim_apostrophes(args[0]))
args.remove_at(0)
return true
Mode.POSITIONAL:
@@ -111,3 +111,10 @@ static func _parse_opt(args: Array[String], opt: Option) -> bool:
return false
push_error("unreachable")
return false
+
+static func trim_apostrophes(s: String) -> String:
+ # Godot doesn't remove apostrophes when adding custom arguments with
+ # customize run instances in the editor. We'll have to remove them manually.
+ if OS.has_feature("editor_runtime"):
+ return s.trim_prefix("\"").trim_prefix("\'").trim_suffix("\"").trim_suffix("\'")
+ return s # Not running in editor