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

Add temp::// AssetSource for Temporary Assets #13403

Open
bushrat011899 opened this issue May 17, 2024 · 0 comments · May be fixed by #13406
Open

Add temp::// AssetSource for Temporary Assets #13403

bushrat011899 opened this issue May 17, 2024 · 0 comments · May be fixed by #13406
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Enhancement A new feature D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon

Comments

@bushrat011899
Copy link
Contributor

What problem does this solve or what need does it fill?

In certain contexts, it is advantageous to store temporary assets in the underlying filesystem which may or may not be deleted when the application exits.

What solution would you like?

  • A new AssetSource, bikeshedded as temp:://, which will use an appropriate system folder to store assets written to it during runtime.
    • This may be appropriate to expose as a configuration option.
    • Note that the tempfile crate is currently transiently included in Bevy, so an implementation based on it should have no impact on build times.
  • The source may or may not be empty on application start (cached assets from a previous run for example). It should be configurable as to whether the temp:// source will be explicitly cleared on startup.
  • The source may or may not be cleared on application exit (cached assets for a future run for example). It should be configurable as to whether the temp:// source will be explicitly cleared on exit.

What alternative(s) have you considered?

Temporary assets can currently be stored in-memory, and thus automatically "deleted" on program exit.

Additional context

A bit tangential, but this would be an awfully similar arrangement to offering temporary files as an asset source (temp:://). Perhaps a proof of concept for the asset source component of the preferences API could be experimented with there?

Yeah a bit tangential. I don't think the Asset Sources feature needs proving out as its already in use, but I do think a temp:// asset source would be useful. Worth implementing!

Originally posted by @cart in #13312 (comment)

@bushrat011899 bushrat011899 added C-Enhancement A new feature A-Assets Load files from disk to use for things like images, models, and sounds X-Uncontroversial This work is generally agreed upon D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels May 17, 2024
@alice-i-cecile alice-i-cecile added the S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! label May 17, 2024
@bushrat011899 bushrat011899 linked a pull request May 17, 2024 that will close this issue
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 C-Enhancement A new feature D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants