build file paths relative to image path

This commit is contained in:
Nikita Smith
2025-01-16 14:03:14 -08:00
parent b405ed4873
commit de2ea38f50
3 changed files with 14 additions and 29 deletions
+14 -11
View File
@@ -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);
{