diff --git a/scripts/download-zig.sh b/scripts/download-zig.sh index 41f7442fe81877..cec996d47d7005 100755 --- a/scripts/download-zig.sh +++ b/scripts/download-zig.sh @@ -16,30 +16,30 @@ fi case $(uname -ms) in 'Darwin x86_64') - target='macos' - arch='x86_64' - ;; + target='macos' + arch='x86_64' + ;; 'Darwin arm64') - target='macos' - arch='aarch64' - ;; + target='macos' + arch='aarch64' + ;; 'Linux aarch64' | 'Linux arm64') - target='linux' - arch='aarch64' - ;; + target='linux' + arch='aarch64' + ;; 'Linux x86_64') - target='linux' - arch='x86_64' - ;; + target='linux' + arch='x86_64' + ;; *) - printf "error: cannot get platform name from '%s'\n" "${unamestr}" - exit 1 - ;; + printf "error: cannot get platform name from '%s'\n" "${unamestr}" + exit 1 + ;; esac url="https://ziglang.org/builds/zig-${target}-${arch}-${zig_version}.tar.xz" -dest=".cache/zig-${zig_version}.tar.xz" -extract_at=".cache/zig" +dest="$(pwd)/.cache/zig-${zig_version}.tar.xz" +extract_at="$(pwd)/.cache/zig" mkdir -p ".cache" @@ -50,7 +50,7 @@ update_repo_if_needed() { Dockerfile scripts/download-zig.ps1 .github/workflows/* - ); + ) zig_version_previous=$(grep 'recommended_zig_version = "' "build.zig" | cut -d'"' -f2) @@ -59,6 +59,12 @@ update_repo_if_needed() { done printf "Zig was updated to ${zig_version}. Please commit new files." + + # symlink extracted zig to extracted zig.exe + # TODO: Workaround for https://github.com/ziglang/vscode-zig/issues/164 + ln -sf "${extract_at}/zig" "${extract_at}/zig.exe" + chmod +x "${extract_at}/zig.exe" + fi }