Don't auto create assets folder (#11218)
# 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>
This commit is contained in:
parent
371cd69d4b
commit
2847cc6933
@ -6,7 +6,6 @@ mod file_asset;
|
|||||||
#[cfg(not(feature = "multi-threaded"))]
|
#[cfg(not(feature = "multi-threaded"))]
|
||||||
mod sync_file_asset;
|
mod sync_file_asset;
|
||||||
|
|
||||||
use bevy_log::warn;
|
|
||||||
#[cfg(feature = "file_watcher")]
|
#[cfg(feature = "file_watcher")]
|
||||||
pub use file_watcher::*;
|
pub use file_watcher::*;
|
||||||
|
|
||||||
@ -45,12 +44,6 @@ impl FileAssetReader {
|
|||||||
/// See `get_base_path` below.
|
/// See `get_base_path` below.
|
||||||
pub fn new<P: AsRef<Path>>(path: P) -> Self {
|
pub fn new<P: AsRef<Path>>(path: P) -> Self {
|
||||||
let root_path = Self::get_base_path().join(path.as_ref());
|
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 }
|
Self { root_path }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ impl<'a> AssetSourceId<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns [`None`] if this is [`AssetSourceId::Default`] and [`Some`] containing the
|
/// 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> {
|
pub fn as_str(&self) -> Option<&str> {
|
||||||
match self {
|
match self {
|
||||||
AssetSourceId::Default => None,
|
AssetSourceId::Default => None,
|
||||||
@ -486,7 +486,7 @@ impl AssetSource {
|
|||||||
sender,
|
sender,
|
||||||
file_debounce_wait_time,
|
file_debounce_wait_time,
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.expect("Failed to create file watcher"),
|
||||||
));
|
));
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
not(feature = "file_watcher"),
|
not(feature = "file_watcher"),
|
||||||
|
Loading…
Reference in New Issue
Block a user