Skip to content

Commit

Permalink
Don't auto create assets folder (#11218)
Browse files Browse the repository at this point in the history
# Objective

- Don't automatically create an assets folder
- resolves #11208

## Solution

- Removes directory creation from file reader.
- Clearer panic when using file watcher and asset folder doesn't exist

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 8, 2024
1 parent 371cd69 commit 2847cc6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 0 additions & 7 deletions crates/bevy_asset/src/io/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down Expand Up @@ -45,12 +44,6 @@ impl FileAssetReader {
/// See `get_base_path` below.
pub fn new<P: AsRef<Path>>(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 }
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/io/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -486,7 +486,7 @@ impl AssetSource {
sender,
file_debounce_wait_time,
)
.unwrap(),
.expect("Failed to create file watcher"),
));
#[cfg(any(
not(feature = "file_watcher"),
Expand Down

0 comments on commit 2847cc6

Please sign in to comment.