Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AssetMode::Processed #18

Merged
merged 1 commit into from Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion build.rs
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
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