Skip to content

Commit

Permalink
Include asset path in get_meta_path panic message (#11504)
Browse files Browse the repository at this point in the history
# Objective

- Fixes a hurdle encountered when debugging a panic caused by the file
watcher loading a `.gitignore` file, which was hard to debug because
there was no file name in the report, only `asset paths must have
extensions`

## Solution

- Panic with a formatted message that includes the asset path, e.g.
`missing expected extension for asset path .gitignore`

---------

Co-authored-by: Alice Cecile <[email protected]>
Co-authored-by: Doonv <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2024
1 parent 95b9230 commit d974b82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub(crate) fn get_meta_path(path: &Path) -> PathBuf {
let mut meta_path = path.to_path_buf();
let mut extension = path
.extension()
.expect("asset paths must have extensions")
.unwrap_or_else(|| panic!("missing extension for asset path {path:?}"))
.to_os_string();
extension.push(".meta");
meta_path.set_extension(extension);
Expand Down

0 comments on commit d974b82

Please sign in to comment.