Fix dx bundle fails when no assets are copied (#3519)
This commit is contained in:
1 parent
c8d6444e88
commit
20cdafbf16
1 file changed
+16
-14
@@ -179,21 +179,23 @@ impl Bundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let asset_dir = bundle.build.asset_dir();
|
let asset_dir = bundle.build.asset_dir();
|
||||||
let asset_dir_entries = std::fs::read_dir(&asset_dir)
|
if asset_dir.exists() {
|
||||||
.with_context(|| format!("failed to read asset directory {:?}", asset_dir))?;
|
let asset_dir_entries = std::fs::read_dir(&asset_dir)
|
||||||
for entry in asset_dir_entries.flatten() {
|
.with_context(|| format!("failed to read asset directory {:?}", asset_dir))?;
|
||||||
let old = entry
|
for entry in asset_dir_entries.flatten() {
|
||||||
.path()
|
let old = entry
|
||||||
.canonicalize()
|
.path()
|
||||||
.with_context(|| format!("Failed to canonicalize {entry:?}"))?;
|
.canonicalize()
|
||||||
let new = PathBuf::from("assets").join(old.file_name().expect("Filename to exist"));
|
.with_context(|| format!("Failed to canonicalize {entry:?}"))?;
|
||||||
tracing::debug!("Bundled asset: {old:?} -> {new:?}");
|
let new = PathBuf::from("assets").join(old.file_name().expect("Filename to exist"));
|
||||||
|
tracing::debug!("Bundled asset: {old:?} -> {new:?}");
|
||||||
|
|
||||||
bundle_settings
|
bundle_settings
|
||||||
.resources_map
|
.resources_map
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.expect("to be set")
|
.expect("to be set")
|
||||||
.insert(old.display().to_string(), new.display().to_string());
|
.insert(old.display().to_string(), new.display().to_string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for resource_path in bundle_settings.resources.take().into_iter().flatten() {
|
for resource_path in bundle_settings.resources.take().into_iter().flatten() {
|
||||||
|
|||||||
Reference in new issue
Block a user