Fix outdir not work when run dx bundle --platform web --outdir mydir (#3572)

* Make legacy asset dir optional
* properly implement outdir

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Co-authored-by:  Nathy-bajo <bajon7680@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-01-16 15:17:33 -08:00
1 parent db16de15c5
commit 19d5fae12d
9 files changed
+152 -143

No files matched your search

+9 -8
View File
@@ -172,14 +172,15 @@ impl AppHandle {
tracing::debug!("Hotreloading asset {changed_file:?} in target {asset_dir:?}");
// If the asset shares the same name in the bundle, reload that
let legacy_asset_dir = self.app.build.krate.legacy_asset_dir();
if changed_file.starts_with(&legacy_asset_dir) {
tracing::debug!("Hotreloading legacy asset {changed_file:?}");
let trimmed = changed_file.strip_prefix(legacy_asset_dir).unwrap();
let res = std::fs::copy(changed_file, asset_dir.join(trimmed));
bundled_name = Some(trimmed.to_path_buf());
if let Err(e) = res {
tracing::debug!("Failed to hotreload legacy asset {e}");
if let Some(legacy_asset_dir) = self.app.build.krate.legacy_asset_dir() {
if changed_file.starts_with(&legacy_asset_dir) {
tracing::debug!("Hotreloading legacy asset {changed_file:?}");
let trimmed = changed_file.strip_prefix(legacy_asset_dir).unwrap();
let res = std::fs::copy(changed_file, asset_dir.join(trimmed));
bundled_name = Some(trimmed.to_path_buf());
if let Err(e) = res {
tracing::debug!("Failed to hotreload legacy asset {e}");
}
}
}