`AssetIo::root_path`
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 4d 8m
- Merged PRs (30d)
- 147
Description
## What problem does this solve or what need does it fill?
It is useful to get the asset directory path however, currently this is only achievable via the `AssetServerSettings` which is a little unintuitive.
## What solution would you like?
The `AssetIo` trait should expose a `root_dir` function (or something similar to that name `asset_root_dir`) which returns a `&Path` (or `Option<&Path>`) to the asset directory.
This spawned form [this discussion](https://discord.com/channels/691052431525675048/742884593551802431/841824129422589953).
It should also be noted that this would need to be based on #2123 since this PR exposes an `asset_io()` method on `AssetServer`.
## What alternative(s) have you considered?
Use the `AssetServerSettings` resource or manually use "assets/" (though this is not reliable).
## Additional context
Ideally the API would be something like:
```rust
fn asset_directory(asset_server: Res) {
let asset_dir = asset_server.asset_io().root_dir();
}
```
Contributor guide
Assessment
This issue has not been assessed yet.