bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Asset Server incorrectly parsing files with # in their name

Open thebluefish opened this issue 1 year ago • 2 comments

Bevy version

0.13

What you did

  • Created a file assets/A#.ron
  • Attempted to load this file with bevy

What went wrong

Loading fails, the AssetServer returns LoadState::Failed for the relevant handle. The server appears to be attempting to load file "A" with a "#.ron" label.

Additional information

Based on this issue, I discovered that we can first convert the file to a Path:

asset_server.load("A#.ron") // fails
asset_server.load(Path::new("A#.ron")) // works
asset_server.load(Path::new("foo.gltf#Scene0")) // fails

However this is not a great solution, IMO ideally these could be unified in some way and a better method for handling the delimiter found.

thebluefish avatar May 03 '24 00:05 thebluefish

Would it be comfortable to do it via tuple like asset_server.load((Path::new("A#.ron"), "Scene0")) ?

bugsweeper avatar May 03 '24 13:05 bugsweeper

@thebluefish there is a way to set path with hash and subasset at same time explicitly with code like this asset_server.load(AssetPath::from_path(Path::new("A#.ron")).with_label("Scene0"));

bugsweeper avatar May 08 '24 09:05 bugsweeper