vleue / bevy_embedded_assets

Bevy plugin to embed assets in your game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Be on Windows in a bevy project folder
  2. Create a .cargo/config.toml in project folder with (expects assets to also be in project root)
    [env]
    BEVY_ASSET_PATH = { relative = true, value = "assets" }
  3. 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 👍