diff --git a/crates/bevy_asset/src/io/file/file_watcher.rs b/crates/bevy_asset/src/io/file/file_watcher.rs index fbed3f8a0ecbe..12793b738b93c 100644 --- a/crates/bevy_asset/src/io/file/file_watcher.rs +++ b/crates/bevy_asset/src/io/file/file_watcher.rs @@ -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")