From 1224eb229039018d44fdff2ebc4c89325672f849 Mon Sep 17 00:00:00 2001 From: Not-Nik Date: Sat, 28 Sep 2024 19:43:57 +0200 Subject: [PATCH] emcc: Fix build (#155) --- emcc.zig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/emcc.zig b/emcc.zig index 0c2f9f0..31def68 100644 --- a/emcc.zig +++ b/emcc.zig @@ -11,11 +11,15 @@ pub fn emscriptenRunStep(b: *std.Build) !*std.Build.Step.Run { .windows => "emrun.bat", else => "emrun", }; - const emrun_run_arg = try b.allocator.alloc(u8, b.sysroot.?.len + emrunExe.len + 1); + var emrun_run_arg = try b.allocator.alloc(u8, b.sysroot.?.len + emrunExe.len + 1); defer b.allocator.free(emrun_run_arg); if (b.sysroot == null) { - emrun_run_arg = emrunExe; + emrun_run_arg = try std.fmt.bufPrint( + emrun_run_arg, + "{s}", + .{ emrunExe } + ); } else { emrun_run_arg = try std.fmt.bufPrint( emrun_run_arg, @@ -74,7 +78,11 @@ pub fn linkWithEmscripten( defer b.allocator.free(emcc_run_arg); if (b.sysroot == null) { - emcc_run_arg = emccExe; + emcc_run_arg = try std.fmt.bufPrint( + emcc_run_arg, + "{s}", + .{ emccExe } + ); } else { emcc_run_arg = try std.fmt.bufPrint( emcc_run_arg,