From 11f1d4ad2be7265fb59843f1ec4f1e656109e5e4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Amiel Date: Wed, 18 Oct 2023 14:40:42 +0200 Subject: [PATCH] Display LIBXML2 env value on errors. --- build.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 0f4d3dbb0a..3ce598eb51 100644 --- a/build.rs +++ b/build.rs @@ -3,8 +3,15 @@ fn main() { // println!("{:?}", std::env::vars()); // panic!("set libxml2."); let p = std::path::Path::new(s); - let fname = std::path::Path::new(p.file_name().expect("no file name in LIBXML2 env")); - assert!(p.is_file()); + let fname = std::path::Path::new( + p.file_name() + .unwrap_or_else(|| panic!("no file name in LIBXML2 env ({s})")), + ); + assert!( + p.is_file(), + "{}", + &format!("not a file in LIBXML2 env ({s})") + ); println!( "cargo:rustc-link-lib={}", fname