From f57137288bcfba1428d906772eab919e52ab2667 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 9 Jun 2026 15:36:59 -0700 Subject: [PATCH] check if rdi path is writable before deciding to convert to it; if it isn't writable, then redirect to a rdi cache directory --- src/dbg_info/dbg_info.c | 21 +++++++++++++++++++++ src/dbg_info/dbg_info.h | 2 ++ src/http/http_stub.c | 1 + 3 files changed, 24 insertions(+) diff --git a/src/dbg_info/dbg_info.c b/src/dbg_info/dbg_info.c index bb7f7f81..311424b4 100644 --- a/src/dbg_info/dbg_info.c +++ b/src/dbg_info/dbg_info.c @@ -750,6 +750,27 @@ di_async_tick(void) } } + //- rjf: determine if RDI path is writable; if not, need to write into the writable cache path + if(!t->og_folder_analyzed) + { + t->og_folder_analyzed = 1; + File file = file_open(AccessFlag_Write, rdi_path); + t->og_folder_is_writable = !file_match(file, file_zero()); + file_close(file); + } + + //- rjf: if RDI path is not writable -> adjust into writable cache directory + if(!t->og_folder_is_writable) + { + String8 cache_folder = get_process_info()->user_program_cache_data_path; + String8 raddbg_folder = str8f(scratch.arena, "%S/raddbg", cache_folder); + String8 rdis_folder = str8f(scratch.arena, "%S/rdis", raddbg_folder); + make_directory(cache_folder); + make_directory(raddbg_folder); + make_directory(rdis_folder); + rdi_path = str8f(scratch.arena, "%S/%S.rdi", rdis_folder, str8_chop_last_dot(str8_skip_last_slash(og_path))); + } + //- rjf: determine if RDI is stale if(!t->rdi_analyzed && !og_is_downloading) { diff --git a/src/dbg_info/dbg_info.h b/src/dbg_info/dbg_info.h index a4272d9c..85fb9a03 100644 --- a/src/dbg_info/dbg_info.h +++ b/src/dbg_info/dbg_info.h @@ -139,6 +139,8 @@ struct DI_LoadTask B32 og_analyzed; B32 og_is_rdi; + B32 og_folder_analyzed; + B32 og_folder_is_writable; U64 og_size; B32 rdi_analyzed; diff --git a/src/http/http_stub.c b/src/http/http_stub.c index 5074dcd8..73db16a5 100644 --- a/src/http/http_stub.c +++ b/src/http/http_stub.c @@ -5,6 +5,7 @@ //~ rjf: @per_os_impl Top-Level Layer Calls internal void http_init(void){} +internal void http_async_tick(void){} //////////////////////////////////////////////////////////////// //~ rjf: @per_os_impl I/O Ring Functions