file_watcher
feature cannot find assets folder in workspace
#16879
Labels
file_watcher
feature cannot find assets folder in workspace
#16879
Bevy version
v0.15.0 #3f2baf8ec
[Optional] Relevant system information
Observed on both Arch Linux and macOS.
What you did
A basic workspace setup where the actual bevy App launches from a subcrate, like the following Cargo.toml setup:
The assets folder for the game resides in the
main_bevy_game
root. There are no other assets folders in the workspace.main_bevy_game
enablesfile_watcher
feature, and then inmain.rs
:What went wrong
On launch, bevy issues the following warning:
WARN bevy_asset::io::source: Skip creating file watcher because path "assets" does not exist.
Creating a folder at the root of the workspace will suppress this warning, but file changes are not recognized.
Moving the assets folder to the root of the workspace causes a panic:
Failed to create file watcher from path "assets", Error { kind: PathNotFound, paths: ["/Users/notarealuser/workspace/main_bevy_game/assets"] }
(Path altered for privacy)
Additional information
I believe this is from using a raw
std::path::PathBuf
to test if the assets folder exists whereas in most other cases it gets built out.I have a quick one-line fix:
bevy_asset
crate @bevy_assets/src/io/source.rs
line 534:
let path = super::file::get_base_path().join(path.clone());
This builds the path as it does in
file::FileWatcher::new()
and seems to make everything work as expected.This might not be the appropriate fix, or perhaps my project structure is not as intended. I'm not sure, so I haven't opened a PR for this one line change.
The text was updated successfully, but these errors were encountered: