Make append function add newline before appending

axtloss/rework-partitioning
axtloss 2 years ago
parent 1fce78304f
commit 660407638d

@ -32,7 +32,9 @@ pub fn copy_file(path: &str, destpath: &str) {
pub fn append_file(path: &str, content: &str) -> std::io::Result<()> { pub fn append_file(path: &str, content: &str) -> std::io::Result<()> {
log::info!("Append '{}' to file {}", content.trim_end(), path); log::info!("Append '{}' to file {}", content.trim_end(), path);
let mut file = OpenOptions::new().append(true).open(path)?; let mut file = OpenOptions::new().append(true).open(path)?;
file.write_all("\n".as_bytes())?;
file.write_all(content.as_bytes())?; file.write_all(content.as_bytes())?;
file.write("\n".as_bytes())?;
Ok(()) Ok(())
} }

Loading…
Cancel
Save