aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-02-05 13:58:32 +0000
committerGitHub <noreply@github.com>2024-02-05 13:58:32 +0000
commit1ebb7f8e9dd337f482f4ce04563b80a00c47443e (patch)
tree524794b638c1757d040e6d7ab4dd0fe902473e93 /src/main.cpp
parent4685cf10851a5ebe1a13fd90acabe1ea8c21dee2 (diff)
parent8ea8fbeccbe35a88765782f807430238c498ab41 (diff)
Merge pull request #3170 from flysand7/run-args-fix
Make run args take the first '--' as the start of the args, instead of the last '--'
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6a033dd3f..1136db62a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2425,14 +2425,18 @@ int main(int arg_count, char const **arg_ptr) {
Array<String> run_args = array_make<String>(heap_allocator(), 0, arg_count);
defer (array_free(&run_args));
+ isize run_args_start_idx = -1;
for_array(i, args) {
if (args[i] == "--") {
- last_non_run_arg = i;
+ run_args_start_idx = i;
+ break;
}
- if (i <= last_non_run_arg) {
- continue;
+ }
+ if(run_args_start_idx != -1) {
+ last_non_run_arg = run_args_start_idx;
+ for(isize i = run_args_start_idx+1; i < args.count; ++i) {
+ array_add(&run_args, args[i]);
}
- array_add(&run_args, args[i]);
}
args = array_slice(args, 0, last_non_run_arg);