Skip to content

Commit

Permalink
fix: support relative path of dict path
Browse files Browse the repository at this point in the history
  • Loading branch information
waynezhang committed Feb 9, 2025
1 parent 09f414f commit 9c38195
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/http/download.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ pub fn downloadFiles(alloc: mem.Allocator, urls: []const []const u8, base_path:
skipped: i16,
failed: i16,
} {
std.fs.cwd().makeDir(base_path) catch |err| switch (err) {
const abs_base_path = try file.toAbsolutePath(alloc, base_path, null);
defer alloc.free(abs_base_path);

std.fs.cwd().makeDir(abs_base_path) catch |err| switch (err) {
error.PathAlreadyExists => {},
else => {
return err;
Expand All @@ -33,7 +36,7 @@ pub fn downloadFiles(alloc: mem.Allocator, urls: []const []const u8, base_path:
}
const filename = file.extractFilename(url);
const full_path = try std.fs.path.join(alloc, &[_][]const u8{
base_path,
abs_base_path,
filename,
});
defer alloc.free(full_path);
Expand Down

0 comments on commit 9c38195

Please sign in to comment.