From 37a06ba56ec27223a10fcfb53a27a0644c0ce4a9 Mon Sep 17 00:00:00 2001 From: Chan Lee Date: Sat, 14 Dec 2024 19:47:08 +0800 Subject: [PATCH] fix incorrect zig-cc toolchain wrapper path on Windows --- xmake/toolchains/zig/xmake.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xmake/toolchains/zig/xmake.lua b/xmake/toolchains/zig/xmake.lua index 4a92bb59d3..701bf2e787 100644 --- a/xmake/toolchains/zig/xmake.lua +++ b/xmake/toolchains/zig/xmake.lua @@ -29,11 +29,12 @@ toolchain("zig") -- @see https://github.com/xmake-io/xmake/issues/5610 function _setup_zigcc_wrapper(zig) + local script_suffix = is_host("windows") and ".cmd" or "" for _, tool in ipairs({"cc", "c++", "ar", "ranlib", "objcopy"}) do - local wrapper_path = path.join(os.tmpdir(), "zigcc", tool) + local wrapper_path = path.join(os.tmpdir(), "zigcc", tool) .. script_suffix if not os.isfile(wrapper_path) then if is_host("windows") then - io.writefile(wrapper_path .. ".cmd", ("@echo off\n\"%s\" %s %%*"):format(zig, tool)) + io.writefile(wrapper_path, ("@echo off\n\"%s\" %s %%*"):format(zig, tool)) else io.writefile(wrapper_path, ("#!/bin/bash\nexec \"%s\" %s \"$@\""):format(zig, tool)) os.runv("chmod", {"+x", wrapper_path})