mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
parent
1ce0994897
commit
435c8ad703
@ -428,5 +428,7 @@ export fn stage2_fetch_file(
|
||||
const max_file_size = std.math.maxInt(u32);
|
||||
const contents = comp.stage1_cache_manifest.addFilePostFetch(file_path, max_file_size) catch return null;
|
||||
result_len.* = contents.len;
|
||||
// TODO https://github.com/ziglang/zig/issues/3328#issuecomment-716749475
|
||||
if (contents.len == 0) return @intToPtr(?[*]const u8, 0x1);
|
||||
return contents.ptr;
|
||||
}
|
||||
|
||||
@ -8052,13 +8052,10 @@ not_integer:
|
||||
}
|
||||
|
||||
Error file_fetch(CodeGen *g, Buf *resolved_path, Buf *contents_buf) {
|
||||
size_t len = 0xAA;
|
||||
size_t len;
|
||||
const char *contents = stage2_fetch_file(&g->stage1, buf_ptr(resolved_path), buf_len(resolved_path), &len);
|
||||
if (len == 0) {
|
||||
// File exists but is empty (otherwise it would be 0xAA)
|
||||
} else if (contents == nullptr) {
|
||||
if (contents == nullptr)
|
||||
return ErrorFileNotFound;
|
||||
}
|
||||
buf_init_from_mem(contents_buf, contents, len);
|
||||
return ErrorNone;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user