aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index eb9e73342..54b0390bf 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -5440,14 +5440,27 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
return nullptr;
}
+ isize files_with_ext = 0;
isize files_to_reserve = 1; // always reserve 1
for (FileInfo fi : list) {
String name = fi.name;
String ext = path_extension(name);
+ if (ext == FILE_EXT) {
+ files_with_ext += 1;
+ }
if (ext == FILE_EXT && !is_excluded_target_filename(name)) {
files_to_reserve += 1;
}
}
+ if (files_with_ext == 0 || files_to_reserve == 1) {
+ if (files_to_reserve == 1) {
+ syntax_error(pos, "Directory contains no .odin files for the specified platform: %.*s", LIT(rel_path));
+ } else {
+ syntax_error(pos, "Empty directory that contains no .odin files: %.*s", LIT(rel_path));
+ }
+ return nullptr;
+ }
+
array_reserve(&pkg->files, files_to_reserve);
for (FileInfo fi : list) {