diff --git a/libcitadel/src/header.rs b/libcitadel/src/header.rs index bb6b618..9df4bcc 100644 --- a/libcitadel/src/header.rs +++ b/libcitadel/src/header.rs @@ -1,5 +1,5 @@ use std::cell::RefCell; -use std::fs::File; +use std::fs::{File,OpenOptions}; use std::io::{Read, Write}; use std::path::Path; @@ -245,6 +245,10 @@ impl ImageHeader { Ok(()) } + pub fn write_header_to>(&self, path: P) -> Result<()> { + self.write_header(OpenOptions::new().write(true).open(path.as_ref())?) + } + pub fn clear(&self) { for b in &mut self.0.borrow_mut()[..] { *b = 0;