Open
Description
Here is a minimal reproducible example: https://github.com/andriyDev/wasm-path-error
The file!()
macro produces nonsensical paths for WASM built on Windows.
On Windows, file!()
in src/lib.rs
produces src\\lib.rs
with the components ["src", "lib.rs"]
.
I would expect file!()
to produce the same set of components on WASM. However, on WASM built on Windows, file!()
in src/lib.rs
produces src\\lib.rs
with the components ["src\\lib.rs"]
.
It seems that the path is not translated appropriately from Windows to WASM.
Meta
rustc --version --verbose
:
rustc 1.85.0 (4d91de4e4 2025-02-17)
binary: rustc
commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
commit-date: 2025-02-17
host: x86_64-pc-windows-msvc
release: 1.85.0
LLVM version: 19.1.7
Additional Context
This is relevant for bevyengine/bevy#14246. We are using the file path to refer to an asset in the src
directory, but due to the incorrect components, we can't remove the src
prefix.