mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-15 08:32:22 -07:00
switch to os_full_path_from_path
This commit is contained in:
+6
-6
@@ -1285,11 +1285,11 @@ lnk_push_input_from_lazy(Arena *arena, PathStyle path_style, LNK_LazySymbol *laz
|
||||
}
|
||||
|
||||
LNK_InputObj *input = lnk_input_obj_list_push(arena, input_obj_list);
|
||||
input->is_thin = is_thin;
|
||||
input->dedup_id = push_str8f(arena, "%S(%S)", lazy->lib->path, obj_path);
|
||||
input->path = obj_path;
|
||||
input->data = member_info.data;
|
||||
input->lib_path = lazy->lib->path;
|
||||
input->is_thin = is_thin;
|
||||
input->dedup_id = push_str8f(arena, "%S/%S", lazy->lib->path, obj_path);
|
||||
input->path = obj_path;
|
||||
input->data = member_info.data;
|
||||
input->lib_path = lazy->lib->path;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -3557,7 +3557,7 @@ l.count += 1; \
|
||||
continue;
|
||||
}
|
||||
|
||||
String8 full_path = os_make_full_path(scratch.arena, input->dedup_id);
|
||||
String8 full_path = os_full_path_from_path(scratch.arena, input->dedup_id);
|
||||
B32 was_full_path_used = hash_table_search_path_u64(loaded_obj_ht, full_path, 0);
|
||||
if (was_full_path_used) {
|
||||
continue;
|
||||
|
||||
@@ -1819,25 +1819,25 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
|
||||
String8 ext = (config->file_characteristics & PE_ImageFileCharacteristic_FILE_DLL) ? str8_lit("dll") : str8_lit("exe");
|
||||
config->image_name = make_file_path_with_ext(scratch.arena, name, ext);
|
||||
}
|
||||
config->image_name = os_make_full_path(arena, config->image_name);
|
||||
config->image_name = os_full_path_from_path(arena, config->image_name);
|
||||
|
||||
// handle empty /PDB
|
||||
if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_Pdb)) {
|
||||
config->pdb_name = make_file_path_with_ext(arena, config->image_name, str8_lit("pdb"));
|
||||
}
|
||||
config->pdb_name = os_make_full_path(arena, config->pdb_name);
|
||||
config->pdb_name = os_full_path_from_path(arena, config->pdb_name);
|
||||
|
||||
// handle empty /RAD_DEBUG_NAME
|
||||
if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_Rad_DebugName)) {
|
||||
config->rad_debug_name = make_file_name_with_ext(arena, config->image_name, str8_lit("rdi"));
|
||||
}
|
||||
config->rad_debug_name = os_make_full_path(arena, config->rad_debug_name);
|
||||
config->rad_debug_name = os_full_path_from_path(arena, config->rad_debug_name);
|
||||
|
||||
// handle empty /IMPLIB
|
||||
if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_ImpLib)) {
|
||||
config->imp_lib_name = make_file_name_with_ext(arena, config->image_name, str8_lit("lib"));
|
||||
}
|
||||
config->imp_lib_name = os_make_full_path(arena, config->imp_lib_name);
|
||||
config->imp_lib_name = os_full_path_from_path(arena, config->imp_lib_name);
|
||||
|
||||
// handle empty /MANIFESTFILE
|
||||
if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_ManifestFile)) {
|
||||
|
||||
@@ -73,27 +73,6 @@ os_w32_is_path_relative_current_directory(String8 path)
|
||||
return 1;
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_make_full_path(Arena *arena, String8 path)
|
||||
{
|
||||
String8 full_path;
|
||||
if (os_w32_is_path_relative_current_directory(path)) {
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8 current_dir = os_get_current_path(scratch.arena);
|
||||
String8List list = {0};
|
||||
str8_list_push(scratch.arena, &list, current_dir);
|
||||
str8_list_push(scratch.arena, &list, path);
|
||||
String8 temp_full_path = str8_list_join(scratch.arena, &list, &(StringJoin){ .sep = str8_lit_comp("\\") });
|
||||
String8List split_full_path = str8_split_path(scratch.arena, temp_full_path);
|
||||
str8_path_list_resolve_dots_in_place(&split_full_path, PathStyle_WindowsAbsolute);
|
||||
full_path = str8_list_join(arena, &split_full_path, &(StringJoin){ .sep = str8_lit_comp("\\") });
|
||||
scratch_end(scratch);
|
||||
} else {
|
||||
full_path = push_str8_copy(arena, path);
|
||||
}
|
||||
return full_path;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_folder_path_exists(String8 path)
|
||||
{
|
||||
|
||||
@@ -494,11 +494,18 @@ internal String8
|
||||
os_full_path_from_path(Arena *arena, String8 path)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DWORD buffer_size = MAX_PATH + 1;
|
||||
U16 *buffer = push_array_no_zero(scratch.arena, U16, buffer_size);
|
||||
String16 path16 = str16_from_8(scratch.arena, path);
|
||||
DWORD path16_size = GetFullPathNameW((WCHAR*)path16.str, buffer_size, (WCHAR*)buffer, NULL);
|
||||
String8 full_path = str8_from_16(arena, str16(buffer, path16_size));
|
||||
DWORD buffer_size = Max(MAX_PATH, path.size * 2) + 1;
|
||||
String16 path16 = str16_from_8(scratch.arena, path);
|
||||
WCHAR *buffer = push_array_no_zero(scratch.arena, WCHAR, buffer_size);
|
||||
DWORD path16_size = GetFullPathNameW((WCHAR*)path16.str, buffer_size, buffer, NULL);
|
||||
if(path16_size > buffer_size)
|
||||
{
|
||||
arena_pop(scratch.arena, buffer_size);
|
||||
buffer_size = path16_size + 1;
|
||||
buffer = push_array_no_zero(scratch.arena, WCHAR, buffer_size);
|
||||
path16_size = GetFullPathNameW((WCHAR*)path16.str, buffer_size, buffer, NULL);
|
||||
}
|
||||
String8 full_path = str8_from_16(arena, str16((U16*)buffer, path16_size));
|
||||
scratch_end(scratch);
|
||||
return full_path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user