Merge pull request #3580 from Feoramund/suggest-test-all-packages

Suggest `-all-packages` flag when testing empty directory
This commit is contained in:
gingerBill
2024-05-13 12:42:48 +01:00
committed by GitHub
2 changed files with 5 additions and 4 deletions
+4
View File
@@ -5508,11 +5508,15 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
} }
} }
if (files_with_ext == 0 || files_to_reserve == 1) { if (files_with_ext == 0 || files_to_reserve == 1) {
ERROR_BLOCK();
if (files_with_ext != 0) { if (files_with_ext != 0) {
syntax_error(pos, "Directory contains no .odin files for the specified platform: %.*s", LIT(rel_path)); syntax_error(pos, "Directory contains no .odin files for the specified platform: %.*s", LIT(rel_path));
} else { } else {
syntax_error(pos, "Empty directory that contains no .odin files: %.*s", LIT(rel_path)); syntax_error(pos, "Empty directory that contains no .odin files: %.*s", LIT(rel_path));
} }
if (build_context.command_kind == Command_test) {
error_line("\tSuggestion: Make an .odin file that imports packages to test and use the `-all-packages` flag.");
}
return nullptr; return nullptr;
} }
+1 -4
View File
@@ -400,16 +400,13 @@ gb_internal ReadDirectoryError read_directory(String path, Array<FileInfo> *fi)
continue; continue;
} }
if (S_ISDIR(dir_stat.st_mode)) {
continue;
}
i64 size = dir_stat.st_size; i64 size = dir_stat.st_size;
FileInfo info = {}; FileInfo info = {};
info.name = copy_string(a, name); info.name = copy_string(a, name);
info.fullpath = path_to_full_path(a, filepath); info.fullpath = path_to_full_path(a, filepath);
info.size = size; info.size = size;
info.is_dir = S_ISDIR(dir_stat.st_mode);
array_add(fi, info); array_add(fi, info);
} }