Backslash paths on Windows are not escaped
Meshiest opened this issue · comments
Issue
Paths on Windows that use backslashes are not properly escaped and result in invalid codegen.
Replication
- Be on Windows in a bevy project folder
- Create a
.cargo/config.toml
in project folder with (expectsassets
to also be in project root)[env] BEVY_ASSET_PATH = { relative = true, value = "assets" }
- Observe invalid output
target/debug/build/bevy_embedded_assets_HASH/out/include_all_assets.rs
/// Generated function that will add all assets to the [`EmbeddedAssetIo`]. #[allow(unused_variables)] pub fn include_all_assets(embedded: &mut EmbeddedAssetIo){ embedded.add_asset(std::path::Path::new("face.blend"), include_bytes!("path\prefix\assets\myAsset.ext"));
Expected outcome
Paths with backslashes should have the backslashes escaped.
Example expected output:
/// Generated function that will add all assets to the [`EmbeddedAssetIo`].
#[allow(unused_variables)] pub fn include_all_assets(embedded: &mut EmbeddedAssetIo){
embedded.add_asset(std::path::Path::new("face.blend"), include_bytes!("path\\prefix\\assets\\myAsset.ext"));
thanks, should be fixed on Bevy 0.5 and on main 👍