From d974b8210e05cf808b5debf14616c772a572afab Mon Sep 17 00:00:00 2001 From: Mark Nevill Date: Thu, 25 Jan 2024 08:00:36 +0000 Subject: [PATCH] Include asset path in get_meta_path panic message (#11504) # 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 Co-authored-by: Doonv <58695417+doonv@users.noreply.github.com> --- crates/bevy_asset/src/io/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_asset/src/io/mod.rs b/crates/bevy_asset/src/io/mod.rs index c03afdabf1..15632ed4c9 100644 --- a/crates/bevy_asset/src/io/mod.rs +++ b/crates/bevy_asset/src/io/mod.rs @@ -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);