aboutsummaryrefslogtreecommitdiff
path: root/src/build_settings.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-01-10 16:25:38 +0000
committerGitHub <noreply@github.com>2023-01-10 16:25:38 +0000
commit15469758de19e70ff5499fd353758ba8618026b8 (patch)
tree098dfd51ba97c4464173e05dc19baa95b4ab8579 /src/build_settings.cpp
parent8ef406324bd500cfd9f3d857e3a5d51adce33374 (diff)
parent86511d44e46b6271b01df2cd1ebb83b5496e143c (diff)
Merge branch 'master' into compiler-improvements-2023-01
Diffstat (limited to 'src/build_settings.cpp')
-rw-r--r--src/build_settings.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp
index 1dff5f43e..76a73b0e8 100644
--- a/src/build_settings.cpp
+++ b/src/build_settings.cpp
@@ -1536,6 +1536,25 @@ gb_internal bool init_build_paths(String init_filename) {
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);
+
+ // Note(Dragos): This is a fix for empty filenames
+ // Turn the trailing folder into the file name
+ if (output_path.name.len == 0) {
+ isize len = output_path.basename.len;
+ while (len > 1 && output_path.basename[len - 1] != '/') {
+ len -= 1;
+ }
+ // We reached the slash
+ String old_basename = output_path.basename;
+ output_path.basename.len = len - 1; // Remove the slash
+ output_path.name = substring(old_basename, len, old_basename.len);
+ output_path.basename = copy_string(ha, output_path.basename);
+ output_path.name = copy_string(ha, output_path.name);
+ // The old basename is wrong. Delete it
+ gb_free(ha, old_basename.text);
+
+
+ }
// Replace extension.
if (output_path.ext.len > 0) {