Could I get a quick sanity check on this? Thanks.
const agent_file = fs.openFileAbsolute(agent_path, .{ .mode = .read_only }) catch |err| switch (err) {
error.FileNotFound => blk: {
const file = try fs.createFileAbsolute(agent_path, .{});
errdefer file.close();
try file.writeAll(y3_plist);
log.info("y3 service installed: {s}", .{agent_path});
break :blk file;
},
else => {
log.err("failed to open {s}: {s}", .{ agent_path, @errorName(err) });
return err;
},
};
defer agent_file.close();