diff --git a/build.zig b/build.zig index 5e7d5c7..9eb60b4 100644 --- a/build.zig +++ b/build.zig @@ -82,7 +82,7 @@ pub fn build(b: *std.build.Builder) !void { const example_run_step = b.step(ex_run_stepname, ex_run_stepdesc); const example_step = b.step(ex_name, ex_build_desc); - var example = b.addExecutable(.{ + const example = b.addExecutable(.{ .name = ex_name, .root_source_file = .{ .path = ex_src }, .target = target, @@ -206,7 +206,7 @@ pub fn build(b: *std.build.Builder) !void { .target = target, .optimize = optimize, }); - var pkghash_step = b.step("pkghash", "Build pkghash"); + const pkghash_step = b.step("pkghash", "Build pkghash"); const pkghash_build_step = b.addInstallArtifact(pkghash_exe, .{}); pkghash_step.dependOn(&pkghash_build_step.step); all_step.dependOn(&pkghash_build_step.step); diff --git a/tools/pkghash.zig b/tools/pkghash.zig index 61d4009..805206a 100644 --- a/tools/pkghash.zig +++ b/tools/pkghash.zig @@ -266,8 +266,8 @@ pub fn cmdPkg(gpa: Allocator, arena: Allocator, args: []const []const u8) !void // computePackageHash will close the directory after completion // std.debug.print("abspath: {s}\n", .{cwd_absolute_path}); - var cwd_copy = try fs.openIterableDirAbsolute(cwd_absolute_path, .{}); - errdefer cwd_copy.dir.close(); + var cwd_copy = try fs.openDirAbsolute(cwd_absolute_path, .{}); + errdefer cwd_copy.close(); var thread_pool: ThreadPool = undefined; try thread_pool.init(.{ .allocator = gpa }); @@ -281,7 +281,7 @@ pub fn cmdPkg(gpa: Allocator, arena: Allocator, args: []const []const u8) !void }; break :blk try computePackageHashExcludingDirectories( &thread_pool, - .{ .dir = cwd_copy.dir }, + cwd_copy, excluded_directories, ); }; @@ -355,7 +355,7 @@ fn isExecutable(file: fs.File) !bool { pub fn computePackageHashExcludingDirectories( thread_pool: *ThreadPool, - pkg_dir: fs.IterableDir, + pkg_dir: fs.Dir, excluded_directories: []const []const u8, ) ![Manifest.Hash.digest_length]u8 { const gpa = thread_pool.allocator; @@ -405,7 +405,7 @@ pub fn computePackageHashExcludingDirectories( .failure = undefined, // to be populated by the worker }; wait_group.start(); - try thread_pool.spawn(workerHashFile, .{ pkg_dir.dir, hashed_file, &wait_group }); + try thread_pool.spawn(workerHashFile, .{ pkg_dir, hashed_file, &wait_group }); try all_files.append(hashed_file); }