make sure path exists

This commit is contained in:
Emil Lerch 2026-01-05 00:44:21 -08:00
parent b2c6b3b651
commit f98e11e773
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -30,6 +30,11 @@ fn downloadDatabase(allocator: std.mem.Allocator, path: []const u8) !void {
if (result.status != .ok) return error.DownloadFailed;
// Ensure directory exists
if (std.fs.path.dirname(path)) |dir| {
try std.fs.cwd().makePath(dir);
}
const file = try std.fs.cwd().createFile(path, .{});
defer file.close();
try file.writeAll(response_buf[0..writer.end]);