From 32b82451607d1154e38faf5dbd35aed72a5da036 Mon Sep 17 00:00:00 2001 From: Kyle Wigdor <37520732+nvdaz@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:20:06 -0500 Subject: [PATCH 1/4] Remove asset folder creation from asset reader --- crates/bevy_asset/src/io/file/mod.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/crates/bevy_asset/src/io/file/mod.rs b/crates/bevy_asset/src/io/file/mod.rs index 63a28cbb96a69..8aeff687d6c07 100644 --- a/crates/bevy_asset/src/io/file/mod.rs +++ b/crates/bevy_asset/src/io/file/mod.rs @@ -6,7 +6,6 @@ mod file_asset; #[cfg(not(feature = "multi-threaded"))] mod sync_file_asset; -use bevy_log::warn; #[cfg(feature = "file_watcher")] pub use file_watcher::*; @@ -45,12 +44,6 @@ impl FileAssetReader { /// See `get_base_path` below. pub fn new>(path: P) -> Self { let root_path = Self::get_base_path().join(path.as_ref()); - if let Err(e) = std::fs::create_dir_all(&root_path) { - warn!( - "Failed to create root directory {:?} for file asset reader: {:?}", - root_path, e - ); - } Self { root_path } } From 6774ee259f50fb77783fc54f5c9361659afe0ffd Mon Sep 17 00:00:00 2001 From: Kyle Wigdor <37520732+nvdaz@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:25:10 -0500 Subject: [PATCH 2/4] Make panic clearer when using file watcher without assets folder --- crates/bevy_asset/src/io/source.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_asset/src/io/source.rs b/crates/bevy_asset/src/io/source.rs index 36e01c561260d..e782e595f9222 100644 --- a/crates/bevy_asset/src/io/source.rs +++ b/crates/bevy_asset/src/io/source.rs @@ -43,7 +43,7 @@ impl<'a> AssetSourceId<'a> { } /// Returns [`None`] if this is [`AssetSourceId::Default`] and [`Some`] containing the - /// the name if this is [`AssetSourceId::Name`]. + /// the name if this is [`AssetSourceId::Name`]. pub fn as_str(&self) -> Option<&str> { match self { AssetSourceId::Default => None, @@ -486,7 +486,7 @@ impl AssetSource { sender, file_debounce_wait_time, ) - .unwrap(), + .unwrap_or_else(|e| panic!("Failed to create file watcher: {}", e)), )); #[cfg(any( not(feature = "file_watcher"), From e5993684badc3a72d505900e236685ea1d183b21 Mon Sep 17 00:00:00 2001 From: Kyle <37520732+nvdaz@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:46:29 -0500 Subject: [PATCH 3/4] fixes typo Co-authored-by: Alice Cecile --- crates/bevy_asset/src/io/source.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_asset/src/io/source.rs b/crates/bevy_asset/src/io/source.rs index e782e595f9222..181da77f49f5d 100644 --- a/crates/bevy_asset/src/io/source.rs +++ b/crates/bevy_asset/src/io/source.rs @@ -43,7 +43,7 @@ impl<'a> AssetSourceId<'a> { } /// Returns [`None`] if this is [`AssetSourceId::Default`] and [`Some`] containing the - /// the name if this is [`AssetSourceId::Name`]. + /// name if this is [`AssetSourceId::Name`]. pub fn as_str(&self) -> Option<&str> { match self { AssetSourceId::Default => None, From 1ac5f58289f13766a590baca5c307fddf973cd14 Mon Sep 17 00:00:00 2001 From: Kyle <37520732+nvdaz@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:33:28 -0500 Subject: [PATCH 4/4] shorten panic Co-authored-by: Nicola Papale --- crates/bevy_asset/src/io/source.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_asset/src/io/source.rs b/crates/bevy_asset/src/io/source.rs index 181da77f49f5d..b16dafb5bfc6c 100644 --- a/crates/bevy_asset/src/io/source.rs +++ b/crates/bevy_asset/src/io/source.rs @@ -486,7 +486,7 @@ impl AssetSource { sender, file_debounce_wait_time, ) - .unwrap_or_else(|e| panic!("Failed to create file watcher: {}", e)), + .expect("Failed to create file watcher"), )); #[cfg(any( not(feature = "file_watcher"),