mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix #3473
Fix the problem where the initial package's directory name ended in .odin.
This commit is contained in:
+3
-1
@@ -5609,7 +5609,7 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
|
|||||||
pkg->foreign_files.allocator = permanent_allocator();
|
pkg->foreign_files.allocator = permanent_allocator();
|
||||||
|
|
||||||
// NOTE(bill): Single file initial package
|
// NOTE(bill): Single file initial package
|
||||||
if (kind == Package_Init && string_ends_with(path, FILE_EXT)) {
|
if (kind == Package_Init && !path_is_directory(path) && string_ends_with(path, FILE_EXT)) {
|
||||||
FileInfo fi = {};
|
FileInfo fi = {};
|
||||||
fi.name = filename_from_path(path);
|
fi.name = filename_from_path(path);
|
||||||
fi.fullpath = path;
|
fi.fullpath = path;
|
||||||
@@ -6529,6 +6529,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) {
|
|||||||
GB_ASSERT(init_filename.text[init_filename.len] == 0);
|
GB_ASSERT(init_filename.text[init_filename.len] == 0);
|
||||||
|
|
||||||
String init_fullpath = path_to_full_path(permanent_allocator(), init_filename);
|
String init_fullpath = path_to_full_path(permanent_allocator(), init_filename);
|
||||||
|
|
||||||
if (!path_is_directory(init_fullpath)) {
|
if (!path_is_directory(init_fullpath)) {
|
||||||
String const ext = str_lit(".odin");
|
String const ext = str_lit(".odin");
|
||||||
if (!string_ends_with(init_fullpath, ext)) {
|
if (!string_ends_with(init_fullpath, ext)) {
|
||||||
@@ -6543,6 +6544,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) {
|
|||||||
if ((build_context.command_kind & Command__does_build) &&
|
if ((build_context.command_kind & Command__does_build) &&
|
||||||
build_context.build_mode == BuildMode_Executable) {
|
build_context.build_mode == BuildMode_Executable) {
|
||||||
String short_path = filename_from_path(path);
|
String short_path = filename_from_path(path);
|
||||||
|
|
||||||
char *cpath = alloc_cstring(temporary_allocator(), short_path);
|
char *cpath = alloc_cstring(temporary_allocator(), short_path);
|
||||||
if (gb_file_exists(cpath)) {
|
if (gb_file_exists(cpath)) {
|
||||||
error({}, "Please specify the executable name with -out:<string> as a directory exists with the same name in the current working directory");
|
error({}, "Please specify the executable name with -out:<string> as a directory exists with the same name in the current working directory");
|
||||||
|
|||||||
Reference in New Issue
Block a user