mirror of
https://github.com/eiskasten/wc-beacon.git
synced 2026-09-08 20:35:09 -05:00
Emit warnings on pgt file being to big
This commit is contained in:
@@ -62,6 +62,10 @@ pub fn set(title: Option<String>, card_type: Option<CardType>, card_id: Option<u
|
||||
if let Some(p) = pgt {
|
||||
let mut f = File::open(p).map_err(|e| err_reason("Unable to read pgt", e))?;
|
||||
f.read_exact(&mut pcd.state.pgt).map_err(|e| err_reason("Unable to read pgt", e))?;
|
||||
match f.read(&mut [0]) {
|
||||
Ok(len) => if len > 0 { eprintln!("warning: provided pgt file is bigger than expected and will be truncated") }
|
||||
Err(e) => eprintln!("warning: unable to check if pgt file is too long: {}", e)
|
||||
}
|
||||
}
|
||||
|
||||
let pcd: PCD<Raw> = (&pcd.serialize()).try_into()?;
|
||||
|
||||
Reference in New Issue
Block a user