swiftwasm / swift

WebAssembly support for the Swift programming language
https://swiftwasm.org
1.29k stars 28 forks source link

Fix `Bundle.module` paths #4573

Open MaxDesiatov opened 2 years ago

MaxDesiatov commented 2 years ago

Currently use of Bundle.module for static resources causes issues, check the URL generated by carton with SwiftWasm 5.6 in this code: https://github.com/swiftwasm/carton/blob/b9dab08e869f51415a55b3bb15a3e29cfd1e16e7/Tests/Fixtures/TestApp/Sources/TestApp/main.swift#L48

It contains full path to the toolchain, which is obviously invalid.

kateinoigakukun commented 2 years ago

FWIW I think the full path was embedded by SwiftPM code generator for Bundle.module

filip-sakel commented 1 year ago

It seems that SwiftPM generates the bundle path here (by appending the bundle extension to the build path), then this property conditionally exposes the bundle path, and finally —on the WASI platform— the entire absolute path is retained, leading to the issue described.