From 2643d14e06915af7f71ae9f3929fbd8a9fde9c5e Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Thu, 30 Apr 2026 16:58:11 -0700 Subject: [PATCH] extend os info struct with binary file path --- src/base/base_processes.h | 1 + src/dbg_info/dbg_info.c | 2 +- src/linux/base/linux_base.c | 4 ++-- src/metagen/metagen_os/core/metagen_os_core.h | 1 + src/win32/base/win32_base.c | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 src/metagen/metagen_os/core/metagen_os_core.h diff --git a/src/base/base_processes.h b/src/base/base_processes.h index a2d1bdee..57a48aa1 100644 --- a/src/base/base_processes.h +++ b/src/base/base_processes.h @@ -9,6 +9,7 @@ struct ProcessInfo { U32 pid; B32 large_pages_allowed; + String8 binary_file_path; String8 binary_path; String8 initial_path; String8 user_program_data_path; diff --git a/src/dbg_info/dbg_info.c b/src/dbg_info/dbg_info.c index 3adf15e9..1ac09aeb 100644 --- a/src/dbg_info/dbg_info.c +++ b/src/dbg_info/dbg_info.c @@ -797,7 +797,7 @@ di_async_tick(void) params.path = get_process_info()->binary_path; params.inherit_env = 1; params.consoleless = 1; - str8_list_push(scratch.arena, ¶ms.cmd_line, os_get_process_info()->binary_path); + str8_list_push(scratch.arena, ¶ms.cmd_line, get_process_info()->binary_file_path); str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--bin"); str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--quiet"); if(should_compress) diff --git a/src/linux/base/linux_base.c b/src/linux/base/linux_base.c index 9e22fda5..86cfe292 100644 --- a/src/linux/base/linux_base.c +++ b/src/linux/base/linux_base.c @@ -1548,8 +1548,8 @@ main(int argc, char **argv) if(got_final_result && size > 0) { String8 full_name = str8(buffer, size); - String8 name_chopped = str8_chop_last_slash(full_name); - info->binary_path = push_str8_copy(lnx_state.arena, name_chopped); + info->binary_file_path = push_str8_copy(os_lnx_state.arena, full_name); + info->binary_path = str8_chop_last_slash(info->binary_file_path); } } diff --git a/src/metagen/metagen_os/core/metagen_os_core.h b/src/metagen/metagen_os/core/metagen_os_core.h new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/metagen/metagen_os/core/metagen_os_core.h @@ -0,0 +1 @@ + diff --git a/src/win32/base/win32_base.c b/src/win32/base/win32_base.c index ea451af3..f7f1e38f 100644 --- a/src/win32/base/win32_base.c +++ b/src/win32/base/win32_base.c @@ -1893,8 +1893,8 @@ w32_entry_point_caller(int argc, WCHAR **wargv) U16 *buffer = push_array_no_zero(scratch.arena, U16, size); DWORD length = GetModuleFileNameW(0, (WCHAR*)buffer, size); String8 name8 = str8_from_16(scratch.arena, str16(buffer, length)); - String8 name_chopped = str8_chop_last_slash(name8); - info->binary_path = push_str8_copy(arena, name_chopped); + info->binary_file_path = push_str8_copy(arena, name8); + info->binary_path = str8_chop_last_slash(info->binary_file_path); scratch_end(scratch); } info->initial_path = get_current_path(arena);