Skip to content

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

Closed
@SludgePhD

Description

@SludgePhD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsC-BugAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Needs-InvestigationThis issue requires detective work to figure out what's going wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions