From 1935811b2c6118e633dd5c4cef2e9e70f7b962e5 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sun, 12 May 2024 19:51:19 -0400 Subject: [PATCH 1/2] Suggest `-all-packages` if testing empty directory --- src/parser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parser.cpp b/src/parser.cpp index ee3c56daf..ad962f53e 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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) { + ERROR_BLOCK(); if (files_with_ext != 0) { 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)); } + 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; } From 971201182abab765bbb99a671eb331b6bedf4bec Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sun, 12 May 2024 19:52:36 -0400 Subject: [PATCH 2/2] Fix `read_directory()` skipping directories on UNIX-likes --- src/path.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/path.cpp b/src/path.cpp index b07f20870..93f6f5000 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -400,16 +400,13 @@ gb_internal ReadDirectoryError read_directory(String path, Array *fi) continue; } - if (S_ISDIR(dir_stat.st_mode)) { - continue; - } - i64 size = dir_stat.st_size; FileInfo info = {}; info.name = copy_string(a, name); info.fullpath = path_to_full_path(a, filepath); info.size = size; + info.is_dir = S_ISDIR(dir_stat.st_mode); array_add(fi, info); }