mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
e72f4ef9e9
I updated my 'main' branch, which accidentally closed the original PR #13747. I'm reopening the this from an actual branch on my repo like I should have done in the first place. Here's the original info from the first PR: * * * # Problem The `file_watcher` feature panics if the file_watcher's path "assets" is not present. I stumbled upon this behavior when I was actually testing against `embedded_watcher`. I had no "assets" directory and didn't need one for [my project](https://github.com/shanecelis/bevy_plane_cut). ```text $ cargo run --example simple; # Runs fine. $ cargo run --example simple --feature embedded_watcher; # Panics thread 'main' panicked at /Users/shane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.14.0-rc.2/src/io/source.rs:503:21: Failed to create file watcher from path "assets", Error { kind: PathNotFound, paths: ["/Users/shane/Projects/bevy_plane_cut/assets"] } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` # Opinion If a project runs without panicing, then adding the `file_watcher` feature shouldn't cause it to panic. # Suggested Solution This PR suggests if the "assets" path does not exist, emit a warning stating that the file watcher could not be created and why. All other errors will be treated as before with a panic and a message. ```text $ cargo run --example simple --feature embedded_watcher; # Panics 2024-06-08T08:55:11.385249Z WARN bevy_asset::io::source: Skip creating file watcher because path "assets" does not exist. 2024-06-08T08:55:11.385291Z WARN bevy_asset::io::source: AssetSourceId::Default does not have an AssetWatcher configured. Consider enabling the `file_watcher` feature. ``` The second warning is new and I'd prefer it didn't emit under this condition, but I'll wait to see whether this is actually regarded as a bug. # Testing No tests added. Compiled against my project and it demonstrated the suggested behavior. * * * I changed the second warning to the following when the `file_watcher` feature is present. When it's not present, it uses the same warning as before. ``` 024-06-09T01:22:16.880619Z WARN bevy_asset::io::source: Skip creating file watcher because path "assets" does not exist. 2024-06-09T01:22:16.880660Z WARN bevy_asset::io::source: AssetSourceId::Default does not have an AssetWatcher configured. Consider adding an "assets" directory. ``` |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |