mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix single-file package case
This commit is contained in:
@@ -1499,13 +1499,20 @@ gb_internal bool init_build_paths(String init_filename) {
|
|||||||
} else if (build_context.build_mode == BuildMode_Executable) {
|
} else if (build_context.build_mode == BuildMode_Executable) {
|
||||||
// By default use no executable extension.
|
// By default use no executable extension.
|
||||||
output_extension = make_string(nullptr, 0);
|
output_extension = make_string(nullptr, 0);
|
||||||
|
String const single_file_extension = str_lit(".odin");
|
||||||
|
|
||||||
if (build_context.metrics.os == TargetOs_windows) {
|
if (build_context.metrics.os == TargetOs_windows) {
|
||||||
output_extension = STR_LIT("exe");
|
output_extension = STR_LIT("exe");
|
||||||
|
} else if (build_context.cross_compiling && selected_target_metrics->metrics == &target_essence_amd64) {
|
||||||
|
output_extension = make_string(nullptr, 0);
|
||||||
} else if (path_is_directory(last_path_element(bc->build_paths[BuildPath_Main_Package].basename))) {
|
} else if (path_is_directory(last_path_element(bc->build_paths[BuildPath_Main_Package].basename))) {
|
||||||
// Add .bin extension to avoid collision
|
// Add .bin extension to avoid collision
|
||||||
// with package directory name
|
// with package directory name
|
||||||
output_extension = STR_LIT("bin");
|
output_extension = STR_LIT("bin");
|
||||||
|
} else if (string_ends_with(init_filename, single_file_extension) && path_is_directory(remove_extension_from_path(init_filename))) {
|
||||||
|
// Add bin extension if compiling single-file package
|
||||||
|
// with same output name as a directory
|
||||||
|
output_extension = STR_LIT("bin");
|
||||||
}
|
}
|
||||||
} else if (build_context.build_mode == BuildMode_DynamicLibrary) {
|
} else if (build_context.build_mode == BuildMode_DynamicLibrary) {
|
||||||
// By default use a .so shared library extension.
|
// By default use a .so shared library extension.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
Path handling utilities.
|
Path handling utilities.
|
||||||
*/
|
*/
|
||||||
#if !defined(GB_SYSTEM_WINDOWS)
|
#if !defined(GB_SYSTEM_WINDOWS)
|
||||||
#include<unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gb_internal String remove_extension_from_path(String const &s) {
|
gb_internal String remove_extension_from_path(String const &s) {
|
||||||
|
|||||||
Reference in New Issue
Block a user