Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Watcher panics if asset file_path starts with ../ #17265

Open
SludgePhD opened this issue Jan 9, 2025 · 0 comments
Open

File Watcher panics if asset file_path starts with ../ #17265

SludgePhD opened this issue Jan 9, 2025 · 0 comments
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@SludgePhD
Copy link
Contributor

Bevy version

0.15

What you did

I have the AssetPlugin configured like this, which worked fine in past bevy versions (and in 0.15 still at least correctly loads assets from that path):

AssetPlugin {
    file_path: "../../assets".into(),
    watch_for_changes_override: Some(true),
    mode: AssetMode::Unprocessed,
    ..Default::default()
}

I use a path with .. here, since my asset directory is in the workspace root, while bevy by default expects it in the crate initializing the engine.

What went wrong

Upon changing a file in the assets directory, the file watcher thread panics like this:

thread 'notify-rs debouncer loop' panicked at /home/sludge/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_asset-0.15.1/src/io/file/file_watcher.rs:51:9:
FileWatcher::get_asset_path() failed to strip prefix from absolute path: absolute_path="/home/sludge/code/Artifice/crates/artifice/../../assets/artifice_sludge/rasterize/blend.wgsl", root="/home/sludge/code/Artifice/assets"

Seems like the produced path needs to be normalized somewhere.

@SludgePhD SludgePhD added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jan 9, 2025
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds S-Needs-Investigation This issue requires detective work to figure out what's going wrong D-Straightforward Simple bug fixes and API improvements, docs, test and examples and removed S-Needs-Triage This issue needs to be labelled labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

2 participants