Skip to content

Commit

Permalink
Add path function to ProcessContext (bevyengine#12636)
Browse files Browse the repository at this point in the history
# Objective

- It can be useful to have access to the path of the current asset being
processed, for example if you want to need a second file that is
relative to the current file being processed.

## Solution

- I added a `path()` function to the `ProcessContext`
  • Loading branch information
BeastLe9enD authored Mar 21, 2024
1 parent ba0f033 commit fcf01a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/bevy_asset/src/processor/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ impl<'a> ProcessContext<'a> {
Ok(loaded_asset)
}

/// The path of the asset being processed.
#[inline]
pub fn path(&self) -> &AssetPath<'static> {
self.path
}

/// The source bytes of the asset being processed.
#[inline]
pub fn asset_bytes(&self) -> &[u8] {
Expand Down

0 comments on commit fcf01a7

Please sign in to comment.