Skip to content

Commit

Permalink
Merge pull request #18 from jf908/main
Browse files Browse the repository at this point in the history
Add support for AssetMode::Processed
  • Loading branch information
mockersf authored Mar 17, 2024
2 parents 28ca79e + ec724dd commit ca0f846
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ fn main() {
for ancestor in path.ancestors() {
if let Some(last) = ancestor.file_name() {
if last == "target" {
return ancestor.parent().map(|p| p.join("assets"));
return ancestor.parent().map(|parent| {
let imported_dir = parent.join("imported_assets");
return if imported_dir.exists() {
imported_dir.join("Default")
} else {
parent.join("assets")
};
});
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ impl Plugin for EmbeddedAssetPlugin {
}
app.register_asset_source(
AssetSourceId::Default,
AssetSource::build().with_reader(|| Box::new(EmbeddedAssetReader::preloaded())),
AssetSource::build()
.with_reader(|| Box::new(EmbeddedAssetReader::preloaded()))
.with_processed_reader(|| Box::new(EmbeddedAssetReader::preloaded())),
);
}
#[cfg(feature = "default-source")]
Expand Down

0 comments on commit ca0f846

Please sign in to comment.