AssetLoader panics when trying to open a file with no extension
in 0.2.1, trying to open a file with no extension causes a panic somewhere in the asset loading pipeline, even when the asset loader used has an empty string in it's extensions(&self) -> &[&str]] value. Not all files have an extension, so it should be possible to open these files, even if it means creating your own AssetLoader. Below is the asset loader that doesn't work. I don't even think it runs, if I place a panic with a specific message in the from_bytes function, the other panics happen before.
#[derive(Default)]
struct Test;
impl AssetLoader<Test> for Test
{
fn from_bytes(&self, _asset_path: &Path, bytes: Vec<u8>) -> Result<Test, Error>
{
Ok(Test)
}
fn extensions(&self) -> &[&str]
{
&[""]
}
}
(as an aside, I think it should be possible to open files that don't match their loader's extensions, as some more general types could accept almost any type, like a loader for Vec<u8> or String)
The assets loader you have written is for empty extension, but an extension nonetheless, so will load files named "test." with the ending '.' , but not just 'test' The panic you have is about MissingAssetHandler I suppose ? I think there is currently no way to load assets files without extensions.
From discord discussion, @cart is looking at some rework of the asset, but still experimenting with it:
cart : Today at 10:03
hard to commit to anything at this point. still in the experimentation phase. im hoping to at least have a final design / direction decided sometime this week.
i do have working code, but its not quite ready for consumption yet
the big decision to make is extending bevy_asset vs integrating atelier_assets
and im working with the atelier dev on that right now
@alice-i-cecile This is stale now, right?
I'm unsure; we haven't touched assets much and I would not be surprised if this panic still occurs. If you can verify that it doesn't I'm happy to close this out.
@alice-i-cecile I believe this issue can finally be closed as part of #10153.
Pretty sure @bushrat011899 is right