Skip to content

Commit

Permalink
build: prevent breakage with relative paths (#97)
Browse files Browse the repository at this point in the history
`thisDir()` returns `@src().file` which isn't always an absolute path
  • Loading branch information
mitchellh committed May 25, 2024
2 parents a284cf8 + a03dd1e commit b3f9918
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ fn benchTargets(

// Open the directory
const c_dir_path = (comptime thisDir()) ++ "/src/bench";
var c_dir = try std.fs.openDirAbsolute(c_dir_path, .{ .iterate = true });
var c_dir = try std.fs.cwd().openDir(c_dir_path, .{ .iterate = true });
defer c_dir.close();

// Go through and add each as a step
Expand Down Expand Up @@ -262,7 +262,7 @@ fn exampleTargets(

// Open the directory
const c_dir_path = (comptime thisDir()) ++ "/examples";
var c_dir = try std.fs.openDirAbsolute(c_dir_path, .{ .iterate = true });
var c_dir = try std.fs.cwd().openDir(c_dir_path, .{ .iterate = true });
defer c_dir.close();

// Go through and add each as a step
Expand Down

0 comments on commit b3f9918

Please sign in to comment.