This commit is contained in:
Jeroen van Rijn
2022-10-08 19:00:05 +02:00
parent 457f509b5f
commit ab7367ae47
+1 -21
View File
@@ -1502,7 +1502,6 @@ bool init_build_paths(String init_filename) {
} else { } else {
Path output_path; Path output_path;
if (str_eq(init_filename, str_lit("."))) {
// We must name the output file after the current directory. // We must name the output file after the current directory.
debugf("Output name will be created from current base name %.*s.\n", LIT(bc->build_paths[BuildPath_Main_Package].basename)); debugf("Output name will be created from current base name %.*s.\n", LIT(bc->build_paths[BuildPath_Main_Package].basename));
String last_element = last_path_element(bc->build_paths[BuildPath_Main_Package].basename); String last_element = last_path_element(bc->build_paths[BuildPath_Main_Package].basename);
@@ -1513,25 +1512,6 @@ bool init_build_paths(String init_filename) {
} }
output_path.basename = copy_string(ha, bc->build_paths[BuildPath_Main_Package].basename); output_path.basename = copy_string(ha, bc->build_paths[BuildPath_Main_Package].basename);
output_path.name = copy_string(ha, last_element); output_path.name = copy_string(ha, last_element);
} else {
// Init filename was not 'current path'.
// Contruct the output name from the path elements as usual.
String output_name = init_filename;
// If it ends with a trailing (back)slash, strip it before continuing.
while (output_name.len > 0 && (output_name[output_name.len-1] == '/' || output_name[output_name.len-1] == '\\')) {
output_name.len -= 1;
}
output_name = remove_directory_from_path(output_name);
output_name = remove_extension_from_path(output_name);
output_name = copy_string(ha, string_trim_whitespace(output_name));
output_path = path_from_string(ha, output_name);
// Replace extension.
if (output_path.ext.len > 0) {
gb_free(ha, output_path.ext.text);
}
}
output_path.ext = copy_string(ha, output_extension); output_path.ext = copy_string(ha, output_extension);
bc->build_paths[BuildPath_Output] = output_path; bc->build_paths[BuildPath_Output] = output_path;
@@ -1539,7 +1519,7 @@ bool init_build_paths(String init_filename) {
// Do we have an extension? We might not if the output filename was supplied. // Do we have an extension? We might not if the output filename was supplied.
if (bc->build_paths[BuildPath_Output].ext.len == 0) { if (bc->build_paths[BuildPath_Output].ext.len == 0) {
if (build_context.metrics.os == TargetOs_windows || build_context.build_mode != BuildMode_Executable) { if (bc->metrics.os == TargetOs_windows || bc->build_mode != BuildMode_Executable) {
bc->build_paths[BuildPath_Output].ext = copy_string(ha, output_extension); bc->build_paths[BuildPath_Output].ext = copy_string(ha, output_extension);
} }
} }