Add path function to ProcessContext (#12636)

# 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`
This commit is contained in:
BeastLe9enD 2024-03-22 00:58:54 +01:00 committed by GitHub
parent ba0f033e8f
commit fcf01a7925
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -364,6 +364,12 @@ impl<'a> ProcessContext<'a> {
Ok(loaded_asset) 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. /// The source bytes of the asset being processed.
#[inline] #[inline]
pub fn asset_bytes(&self) -> &[u8] { pub fn asset_bytes(&self) -> &[u8] {