mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-03 09:14:38 +00:00
Err on empty directory packages
This commit is contained in:
@@ -751,7 +751,7 @@ enum ReadDirectoryError {
|
||||
ReadDirectory_NotExists,
|
||||
ReadDirectory_Permission,
|
||||
ReadDirectory_NotDir,
|
||||
ReadDirectory_EOF,
|
||||
ReadDirectory_Empty,
|
||||
ReadDirectory_Unknown,
|
||||
|
||||
ReadDirectory_COUNT,
|
||||
@@ -858,6 +858,9 @@ ReadDirectoryError read_directory(String path, Array<FileInfo> *fi) {
|
||||
|
||||
} while (FindNextFileW(find_file, &file_data));
|
||||
|
||||
if (fi->count == 0) {
|
||||
return ReadDirectory_Empty;
|
||||
}
|
||||
|
||||
return ReadDirectory_None;
|
||||
}
|
||||
|
||||
@@ -4253,7 +4253,7 @@ ParseFileError parse_import(Parser *p, ImportedPackage imported_package) {
|
||||
GB_ASSERT(import_path != list[0].fullpath);
|
||||
}
|
||||
|
||||
if (rd_err != ReadDirectory_EOF && rd_err != ReadDirectory_None) {
|
||||
if (rd_err != ReadDirectory_None) {
|
||||
if (pos.line != 0) {
|
||||
gb_printf_err("%.*s(%td:%td) ", LIT(pos.file), pos.line, pos.column);
|
||||
}
|
||||
@@ -4282,9 +4282,9 @@ ParseFileError parse_import(Parser *p, ImportedPackage imported_package) {
|
||||
gb_printf_err("Unknown error whilst reading path %.*s\n", LIT(import_rel_path));
|
||||
return ParseFile_InvalidFile;
|
||||
|
||||
case ReadDirectory_EOF:
|
||||
gb_printf_err("Unknown error whilst reading path %.*s\n", LIT(import_rel_path));
|
||||
return ParseFile_InvalidFile;
|
||||
case ReadDirectory_Empty:
|
||||
gb_printf_err("Empty directory: %.*s\n", LIT(import_rel_path));
|
||||
return ParseFile_EmptyFile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user