Expand description
§bevy_dirs
Use the platform-specific data directories as asset sources in bevy.
§Available Dirs
bevy_dirs provides an asset source for each directory provided by
directories, a list of which is
available here.
§Asset Sources
Each directory corresponds to an asset source of the same name.
For example, to read from your project’s config dir (~/.config/project/), you would use:
assets.load("config://my-config.json");However, there is a notable exception, that being that all base directories
begin with the prefix base_. This avoids confusing them with the project
directories of the same name.
For example, to load from the base config dir (~/.config/), you would use:
assets.load("base_config://my-config.json");§Features
bevy_dirs comes with a feature for each directory provided by directories.
If this feature is enabled, it allows you to use the respective directory as an
asset source.
For convenience, all of these features are enabled by default. However, it is
recommended that you disable default features, and only activate the ones that
you need. For example, to only enable the base config directory and the project
data directory you would use the following in your Cargo.toml:
[dependencies]
bevy_dirs = { version = "*", default-features = false, features = ["base_config", "data"] }
# or the following
[dependencies.bevy_dirs]
version = "*"
default-features = false
features = [
"base_config",
"data",
]§Bevy Compatibility
| bevy_dirs | bevy |
|---|---|
| 0.1.0 | ^0.17 |
Structs§
- DirAsset
Reader - An
AssetReaderthat uses thebase_pathto read assets. - Dirs
Plugin - A bevy plugin that adds all of the directories supported by directories based on the enabled features of this crate. See the [features section] for more information about what features are available, and what they mean.
- File
- A wrapper for
async_fs::Fileused by *DirReaders when reading from the file system
Traits§
- DirAsset
Source Ext - Adds the [
register_dir_asset_source] helper function for creating asset sources that point to specific directories.