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. Also apply rustfmt to pdf_export.rs.
This commit is contained in:
Afonsop committed 2026-09-15 18:54:44 +01:00
1 parent 892d693d2d
commit e3c86eca29
2 files changed
+410 -357

No files matched your search

+5 -1
View File
@@ -2,7 +2,11 @@
set -eu
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"
wasm-bindgen \
--target web \