mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
Provide more information when a filewatcher failure is hit. (#13715)
A naked unwrap led to an opaque error that can be hit when using the embedded filewatcher. I've changed this an unwrap_or_else panic! with the error message providing more details about the failed operation. A better solution would be to print an error! and not panic... This was tested with the asset_processing example. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
f7ae277025
commit
3122c87702
1 changed files with 7 additions and 1 deletions
|
@ -46,7 +46,13 @@ impl FileWatcher {
|
|||
impl AssetWatcher for FileWatcher {}
|
||||
|
||||
pub(crate) fn get_asset_path(root: &Path, absolute_path: &Path) -> (PathBuf, bool) {
|
||||
let relative_path = absolute_path.strip_prefix(root).unwrap();
|
||||
let relative_path = absolute_path.strip_prefix(root).unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"FileWatcher::get_asset_path() failed to strip prefix from absolute path: absolute_path={:?}, root={:?}",
|
||||
absolute_path,
|
||||
root
|
||||
)
|
||||
});
|
||||
let is_meta = relative_path
|
||||
.extension()
|
||||
.map(|e| e == "meta")
|
||||
|
|
Loading…
Reference in a new issue