From 660407638deef130ffa3a5399ba98a9aa1b0be83 Mon Sep 17 00:00:00 2001 From: axtloss Date: Fri, 29 Jul 2022 20:04:00 +0200 Subject: [PATCH] Make append function add newline before appending --- src/internal/files.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/internal/files.rs b/src/internal/files.rs index 91bcad2..0523fb2 100755 --- a/src/internal/files.rs +++ b/src/internal/files.rs @@ -32,7 +32,9 @@ pub fn copy_file(path: &str, destpath: &str) { pub fn append_file(path: &str, content: &str) -> std::io::Result<()> { log::info!("Append '{}' to file {}", content.trim_end(), path); let mut file = OpenOptions::new().append(true).open(path)?; + file.write_all("\n".as_bytes())?; file.write_all(content.as_bytes())?; + file.write("\n".as_bytes())?; Ok(()) }