const std = @import("std"); const diag = @import("../diag.zig"); pub fn readFileToBytes( arena: std.mem.Allocator, io: std.Io, base: std.Io.Dir, path: []const u8, diags: *diag.List, ) error{ InvalidConfig, OutOfMemory }![]const u8 { return base.readFileAlloc(io, path, arena, .unlimited) catch |err| { const reason = switch (err) { error.FileNotFound => "does not exist", error.IsDir => "is a directory, not a manifest", error.AccessDenied, error.PermissionDenied => "cannot be read: permission denied", else => "cannot be read", }; try diags.addFmt("manifest '{s}' {s}", .{ path, reason }, .{ .file = path }); return error.InvalidConfig; }; }