mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 14:40:19 +00:00
# Objective - Allow bevy applications that does not have any assets folder to start from a read-only directory. (typically installed to a systems folder) Fixes #10613 ## Solution - warn instead of panic when assets folder creation fails.
This commit is contained in:
parent
2b32de9ba2
commit
9a909f593a
1 changed files with 5 additions and 4 deletions
|
@ -6,6 +6,7 @@ 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::*;
|
||||||
|
|
||||||
|
@ -44,12 +45,12 @@ 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());
|
||||||
std::fs::create_dir_all(&root_path).unwrap_or_else(|e| {
|
if let Err(e) = std::fs::create_dir_all(&root_path) {
|
||||||
panic!(
|
warn!(
|
||||||
"Failed to create root directory {:?} for file asset reader: {:?}",
|
"Failed to create root directory {:?} for file asset reader: {:?}",
|
||||||
root_path, e
|
root_path, e
|
||||||
)
|
);
|
||||||
});
|
}
|
||||||
Self { root_path }
|
Self { root_path }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue