Don't unwrap header metadata
@@ -1607,7 +1607,7 @@ impl Bindings {
}
if let Some(h) = options.input_header.as_ref() {
- let md = std::fs::metadata(h).ok().unwrap();
+ if let Ok(md) = std::fs::metadata(h) {
if !md.is_file() {
eprintln!("error: '{}' is a folder", h);
return Err(());
@@ -1617,6 +1617,10 @@ impl Bindings {
return Err(());
}
options.clang_args.push(h.clone())
+ } else {
+ eprintln!("error: header '{}' does not exist.", h);
+ return Err(());
+ }
}
for f in options.input_unsaved_files.iter() {
