build: make the Trunk web-worker hook work on Windows

Trunk passes TRUNK_STAGING_DIR as an extended-length path (\?\C:\...)
on Windows, which MSYS sh tools cannot stat, so post_build failed and
the whole web build aborted. Strip the prefix with sed before use;
Linux CI paths are unaffected.

(cherry picked from commit e3c86eca29)
This commit is contained in:
Afonsop authored and Hakan Seven committed 2026-10-12 12:02:04 +03:00
1 parent 38f0e2b25f
commit c8386c6d3a
1 file changed
+5 -1
+5 -1
View File
@@ -2,7 +2,11 @@
set -eu set -eu
cargo build --locked --release --target wasm32-unknown-unknown --package ocs_web_worker cargo build --locked --release --target wasm32-unknown-unknown --package ocs_web_worker
worker_out="${TRUNK_STAGING_DIR:?}/worker_pkg" # On Windows, Trunk passes an extended-length path (\\?\C:\...) that MSYS sh
# tools cannot handle; strip the prefix so local web builds work there too.
# CI (Linux) paths never carry the prefix and pass through unchanged.
staging=$(printf '%s\n' "${TRUNK_STAGING_DIR:?}" | sed 's|^\\\\?\\||')
worker_out="${staging:?}/worker_pkg"
mkdir -p "$worker_out" mkdir -p "$worker_out"
wasm-bindgen \ wasm-bindgen \
--target web \ --target web \