make sure path exists
This commit is contained in:
parent
b2c6b3b651
commit
f98e11e773
1 changed files with 5 additions and 0 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue