From c28d653764ca49ae54a9ee94b85680a5868f4296 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 23 Sep 2026 13:19:41 +0200 Subject: print error context when opening files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- src/main.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.zig b/src/main.zig index 6ec4af6..2d055db 100644 --- a/src/main.zig +++ b/src/main.zig @@ -99,10 +99,14 @@ const File = struct { mtime: Io.Timestamp, fn init(io: Io, dir: Io.Dir, path: []const u8, options: ?Io.Dir.OpenFileOptions) !File { - const fd = try dir.openFile(io, path, options orelse .{ + const fd = dir.openFile(io, path, options orelse .{ .lock = .exclusive, .mode = .read_write, - }); + }) catch |err| { + log.err("opening {s}: {any}", .{ path, err }); + return err; + }; + var mmap = try fd.createMemoryMap(io, .{ .len = try fd.length(io), // .protection = .{ .read = true, .write = false }, -- cgit 1.4.1