Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssetLoader panics when trying to open a file with no extension #576

Closed
Matthew-Maclean opened this issue Sep 26, 2020 · 5 comments
Closed
Labels
A-Assets Load files from disk to use for things like images, models, and sounds P-Crash A sudden unexpected crash S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@Matthew-Maclean
Copy link

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)

@Moxinilian Moxinilian added A-Assets Load files from disk to use for things like images, models, and sounds P-Crash A sudden unexpected crash labels Sep 27, 2020
@BorisBoutillier
Copy link
Contributor

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 alice-i-cecile added the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Jul 17, 2022
@alice-i-cecile alice-i-cecile moved this to Cleanup in Asset Pipeline Jul 17, 2022
@targrub
Copy link
Contributor

targrub commented Oct 7, 2022

@alice-i-cecile This is stale now, right?

@alice-i-cecile
Copy link
Member

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.

@bushrat011899
Copy link
Contributor

@alice-i-cecile I believe this issue can finally be closed as part of #10153.

@janhohenheim
Copy link
Member

Pretty sure @bushrat011899 is right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds P-Crash A sudden unexpected crash S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
Status: Assets-wide Bugs
Development

No branches or pull requests

7 participants