add switch to override default logs folder

This commit is contained in:
Nikita Smith
2026-06-02 12:10:04 -07:00
committed by Ryan Fleury
parent b4dd1f6fd3
commit b23323c03d
5 changed files with 32 additions and 22 deletions
+2
View File
@@ -9,6 +9,8 @@ C_LINKAGE thread_static Log *log_active;
C_LINKAGE thread_static Log *log_active = 0; C_LINKAGE thread_static Log *log_active = 0;
#endif #endif
String8 g_logs_folder;
//////////////////////////////// ////////////////////////////////
//~ rjf: Log Creation/Selection //~ rjf: Log Creation/Selection
+5
View File
@@ -36,6 +36,11 @@ struct Log
LogScope *top_scope; LogScope *top_scope;
}; };
////////////////////////////////
// Globals
extern String8 g_logs_folder;
//////////////////////////////// ////////////////////////////////
//~ rjf: Log Creation/Selection //~ rjf: Log Creation/Selection
+6 -11
View File
@@ -53,17 +53,12 @@ d_init(void)
d_ctrl_state->c2u_ring_size = KB(64); d_ctrl_state->c2u_ring_size = KB(64);
d_ctrl_state->c2u_ring_max_string_size = d_ctrl_state->c2u_ring_size/2; d_ctrl_state->c2u_ring_max_string_size = d_ctrl_state->c2u_ring_size/2;
d_ctrl_state->c2u_ring_base = push_array_no_zero(arena, U8, d_ctrl_state->c2u_ring_size); d_ctrl_state->c2u_ring_base = push_array_no_zero(arena, U8, d_ctrl_state->c2u_ring_size);
d_ctrl_state->c2u_ring_mutex = mutex_alloc(); d_ctrl_state->c2u_ring_mutex = mutex_alloc();
d_ctrl_state->c2u_ring_cv = cond_var_alloc(); d_ctrl_state->c2u_ring_cv = cond_var_alloc();
{ {
Temp scratch = scratch_begin(0, 0); d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", g_logs_folder);
String8 user_program_data_path = get_process_info()->user_program_data_path; write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero());
String8 user_data_folder = push_str8f(scratch.arena, "%S/%Sraddbg/logs", user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT)); }
make_directory(user_data_folder);
d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", user_data_folder);
write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero());
scratch_end(scratch);
}
d_ctrl_state->ctrl_thread_entity_ctx_rw_mutex = rw_mutex_alloc(); d_ctrl_state->ctrl_thread_entity_ctx_rw_mutex = rw_mutex_alloc();
d_ctrl_state->ctrl_thread_entity_store = d_entity_ctx_rw_store_alloc(); d_ctrl_state->ctrl_thread_entity_store = d_entity_ctx_rw_store_alloc();
d_ctrl_state->ctrl_thread_eval_cache = e_cache_alloc(); d_ctrl_state->ctrl_thread_eval_cache = e_cache_alloc();
+7 -10
View File
@@ -10597,16 +10597,13 @@ rd_init(CmdLine *cmdln)
rd_state->frame_arenas[idx] = arena_alloc(); rd_state->frame_arenas[idx] = arena_alloc();
} }
rd_state->log = log_alloc(); rd_state->log = log_alloc();
log_select(rd_state->log); log_select(rd_state->log);
{ {
Temp scratch = scratch_begin(0, 0); Temp scratch = scratch_begin(0, 0);
String8 user_program_data_path = get_process_info()->user_program_data_path; rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", g_logs_folder);
String8 user_data_folder = push_str8f(scratch.arena, "%S/%Sraddbg/logs", user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT)); write_data_to_file_path(rd_state->log_path, str8_zero());
rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", user_data_folder); scratch_end(scratch);
make_directory(user_data_folder); }
write_data_to_file_path(rd_state->log_path, str8_zero());
scratch_end(scratch);
}
rd_state->num_frames_requested = 2; rd_state->num_frames_requested = 2;
rd_state->seconds_until_autosave = 0.5f; rd_state->seconds_until_autosave = 0.5f;
rd_state->eval_cache = e_cache_alloc(); rd_state->eval_cache = e_cache_alloc();
+12 -1
View File
@@ -532,7 +532,16 @@ entry_point(CmdLine *cmd_line)
try_u64_from_str8_c_rules(jit_addr_string, &jit_addr); try_u64_from_str8_c_rules(jit_addr_string, &jit_addr);
jit_attach = (jit_addr != 0); jit_attach = (jit_addr != 0);
} }
// init log
g_logs_folder = cmd_line_string(cmd_line, str8_lit("logs"));
if(g_logs_folder.size == 0)
{
String8 user_program_data_path = get_process_info()->user_program_data_path;
g_logs_folder = push_str8f(scratch.arena, "%S/%Sraddbg/logs", program_data_folder_prefix_from_os(OperatingSystem_CURRENT), user_program_data_path);
}
make_directory(g_logs_folder);
//- rjf: dispatch to top-level codepath based on execution mode //- rjf: dispatch to top-level codepath based on execution mode
switch(exec_mode) switch(exec_mode)
{ {
@@ -863,6 +872,8 @@ entry_point(CmdLine *cmd_line)
"This will launch the debugger in the non-graphical IPC mode, which is used to communicate with another running instance of the debugger. The debugger instance will launch, send the specified command, then immediately terminate. This may be used by editors or other programs to control the debugger.\n\n" "This will launch the debugger in the non-graphical IPC mode, which is used to communicate with another running instance of the debugger. The debugger instance will launch, send the specified command, then immediately terminate. This may be used by editors or other programs to control the debugger.\n\n"
"--gen_crash_dump\n" "--gen_crash_dump\n"
"Generate mini dump on crash.\n\n" "Generate mini dump on crash.\n\n"
"--logs:<path>\n"
"Overrides default path to the folder with logs.\n"
)); ));
}break; }break;
} }