diff --git a/crates/bevy_asset/src/io/file/file_watcher.rs b/crates/bevy_asset/src/io/file/file_watcher.rs index f1a26853c4..e70cf1665f 100644 --- a/crates/bevy_asset/src/io/file/file_watcher.rs +++ b/crates/bevy_asset/src/io/file/file_watcher.rs @@ -35,7 +35,7 @@ impl FileWatcher { sender: Sender, debounce_wait_time: Duration, ) -> Result { - let root = normalize_path(&path).canonicalize().unwrap(); + let root = normalize_path(&path).canonicalize()?; let watcher = new_asset_event_debouncer( path.clone(), debounce_wait_time, @@ -262,7 +262,7 @@ impl FilesystemEventHandler for FileEventHandler { self.last_event = None; } fn get_path(&self, absolute_path: &Path) -> Option<(PathBuf, bool)> { - let absolute_path = absolute_path.canonicalize().unwrap(); + let absolute_path = absolute_path.canonicalize().ok()?; Some(get_asset_path(&self.root, &absolute_path)) }