aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorflysand7 <thebumboni@gmail.com>2024-02-04 14:25:53 +1100
committerflysand7 <thebumboni@gmail.com>2024-02-04 14:25:53 +1100
commit8ea8fbeccbe35a88765782f807430238c498ab41 (patch)
tree13c2e0c29c4a9f9c549324dbecf0b1e3ce725ee7 /src/main.cpp
parent4e300ff90a0d4b9d706a21a9fc155aa1536d934c (diff)
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);