mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-14 16:12:24 -07:00
build file paths relative to image path
This commit is contained in:
+14
-11
@@ -1960,35 +1960,38 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
|
||||
|
||||
// handle empty /OUT
|
||||
if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_Out)) {
|
||||
String8 name = str8_list_first(&config->input_list[LNK_Input_Obj]);
|
||||
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);
|
||||
String8 name = str8_list_first(&config->input_list[LNK_Input_Obj]);
|
||||
String8 ext = (config->file_characteristics & PE_ImageFileCharacteristic_FILE_DLL) ? str8_lit("dll") : str8_lit("exe");
|
||||
config->image_name = make_file_name_with_ext(scratch.arena, name, ext);
|
||||
}
|
||||
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 = make_file_name_with_ext(scratch.arena, config->image_name, str8_lit("pdb"));
|
||||
}
|
||||
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 = make_file_name_with_ext(scratch.arena, config->image_name, str8_lit("rdi"));
|
||||
}
|
||||
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 = make_file_name_with_ext(scratch.arena, config->image_name, str8_lit("lib"));
|
||||
}
|
||||
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)) {
|
||||
config->manifest_name = push_str8f(arena, "%S.manifest", config->image_name);
|
||||
config->manifest_name = push_str8f(scratch.arena, "%S.manifest", config->image_name);
|
||||
}
|
||||
|
||||
// convert to full paths
|
||||
config->image_name = os_full_path_from_path(arena, config->image_name);
|
||||
config->pdb_name = os_full_path_from_path(arena, config->pdb_name);
|
||||
config->rad_debug_name = os_full_path_from_path(arena, config->rad_debug_name);
|
||||
config->imp_lib_name = os_full_path_from_path(arena, config->imp_lib_name);
|
||||
config->manifest_name = os_full_path_from_path(arena, config->manifest_name);
|
||||
|
||||
// collect env vars
|
||||
HashTable *env_vars = hash_table_init(scratch.arena, 512);
|
||||
{
|
||||
|
||||
@@ -9,23 +9,6 @@ make_file_name_with_ext(Arena *arena, String8 file_name, String8 ext)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
make_file_path_with_ext(Arena *arena, String8 file_name, String8 ext)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
String8 curr = os_get_current_path(scratch.arena);
|
||||
String8 name = make_file_name_with_ext(scratch.arena, str8_skip_last_slash(file_name), ext);
|
||||
|
||||
String8List list = {0};
|
||||
str8_list_push(scratch.arena, &list, curr);
|
||||
str8_list_push(scratch.arena, &list, name);
|
||||
String8 result = str8_path_list_join_by_style(arena, &list, PathStyle_SystemAbsolute);
|
||||
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
path_char_from_style(PathStyle style)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
internal String8 make_file_name_with_ext(Arena *arena, String8 file_name, String8 ext);
|
||||
internal String8 make_file_path_with_ext(Arena *arena, String8 file_name, String8 ext);
|
||||
internal String8 path_convert_slashes(Arena *arena, String8 path, PathStyle path_style);
|
||||
internal String8 path_canon_from_regular_path(Arena *arena, String8 path);
|
||||
internal PathStyle path_style_from_string(String8 string);
|
||||
|
||||
Reference in New Issue
Block a user