Browse Source

Fix `odin build examples\demo\` trailing slash handling.

Jeroen van Rijn 3 năm trước cách đây
mục cha
commit
3c5124ce68
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      src/build_settings.cpp

+ 6 - 1
src/build_settings.cpp

@@ -1338,7 +1338,12 @@ bool init_build_paths(String init_filename) {
 		} else {
 			// Init filename was not 'current path'.
 			// Contruct the output name from the path elements as usual.
-			String output_name = remove_directory_from_path(init_filename);
+			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);