emscripten-core / emscripten-core/emscripten
file_packager.py: REMOTE_PACKAGE_BASE does not work when data is not a the root
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Please include the following in your bug report:
I'm using `emscripten/tools/file_packager.py` and I noticed something strange, and I guess it's an error
https://github.com/emscripten-core/emscripten/blob/21f25339df9c6aa8c288297de73236e6aaa79582/tools/file_packager.py#L765-L770
As you can see, the var `REMOTE_PACKAGE_BASE` has value `js_manipulation.escape_for_js_string(remote_package_name)`, which is equals to `remote_package_name = os.path.basename(package_name)
`
If during the packing phase, I want to put the data in a subfolder, let's say `build/php-web.data` with the option `--js-output=build/php-web.data.js`, I got the following code:
```js
var PACKAGE_NAME = 'build/php-web.data';
var REMOTE_PACKAGE_BASE = 'php-web.data';
```
And this looks wrong, because the data are in the `build/` directory.
---
The full command to reproduce:
```bash
'python3' \
'/emsdk/upstream/emscripten/tools/file_packager.py' \
'build/php-web.data' \
'--use-preload-cache' \
'--lz4' \
'--preload', '/src' \
'--js-output=build/php-web.data.js' \
'--no-node' \
'--exclude' '*/.*' \
'--export-name=createPhpModule'
```
Contributor guide
Assessment
This issue has not been assessed yet.