file_packager.py: Use last occurrence of @ in --preload-file This means that `@@` escaping is optional for the targets rather than the source. Fixes #15947
diff --git a/ChangeLog.md b/ChangeLog.md index 68c4a0a..8db237a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md
@@ -23,6 +23,9 @@ - `wasmX` test suites that are defined in `test_core.py` have been renamed to `coreX` to better reflect where they are defined. The old suite names such as `wasm2` will continue to work for now as aliases. +- When using `--preload-file` the last `@` is not taken as the dividing point + between the source and target filenames. As previously, `@` can be included + explicitly by escaping using `@@`. 3.1.1 - 08/01/2022 ------------------
diff --git a/tools/file_packager.py b/tools/file_packager.py index da56bed..bce114e 100755 --- a/tools/file_packager.py +++ b/tools/file_packager.py
@@ -237,7 +237,7 @@ mode = leading # position of @ if we're doing 'src@dst'. '__' is used to keep the index # same with the original if they escaped with '@@'. - at_position = arg.replace('@@', '__').find('@') + at_position = arg.replace('@@', '__').rfind('@') # '@@' in input string means there is an actual @ character, a single '@' # means the 'src@dst' notation. uses_at_notation = (at_position != -1)