Skip to content

Commit 541fa86

Browse files
committed
build: mkdir zig-out/bin before symlink
1 parent a17acf1 commit 541fa86

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

build.zig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,17 @@ const CustomHardLinkStep = struct {
177177
const builder = self.builder;
178178

179179
const wrapmain_path = self.exe.getEmittedBin().getPath(builder);
180+
var madeDir = false;
180181
inline for (EXECUTABLES) |exec_decl| {
181182
const exec_name = exec_decl.@"0";
182183
const full_dest_path = builder.getInstallPath(.{ .bin = {} }, exec_name);
183-
std.debug.print("{s} -> {s}\n", .{ wrapmain_path, full_dest_path });
184+
if (!madeDir) {
185+
const dirpath = std.fs.path.dirname(full_dest_path).?;
186+
std.debug.print("mkdir -p {s}\n", .{dirpath});
187+
try std.fs.Dir.makePath(std.fs.cwd(), dirpath);
188+
madeDir = true;
189+
}
190+
std.debug.print("symlink {s} to {s}\n", .{ wrapmain_path, full_dest_path });
184191
try std.fs.cwd().atomicSymLink(wrapmain_path, full_dest_path, .{});
185192
}
186193
}

0 commit comments

Comments
 (0)