aboutsummaryrefslogtreecommitdiff
path: root/src/helper/init.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/helper/init.rs')
-rw-r--r--src/helper/init.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/helper/init.rs b/src/helper/init.rs
index 392e4fb..084caf5 100644
--- a/src/helper/init.rs
+++ b/src/helper/init.rs
@@ -1,12 +1,18 @@
-use std::fs::File;
+use std::fs::OpenOptions;
use std::io::{self, Write};
pub fn print_in_file(content: String) -> io::Result<()> {
// Open the file (create it if it doesn't exist, or truncate it if it does)
- let mut file = File::create("debug.txt")?;
+ let mut file = OpenOptions::new()
+ .write(true)
+ .append(true)
+ .create(true)
+ .open("debug.txt")
+ .unwrap();
- // Write the content to the file
- file.write_all(content.as_bytes())?;
+ if let Err(e) = writeln!(file, "{}", content) {
+ eprintln!("Couldn't write to file: {}", e);
+ }
Ok(())
}
ArKa projects. All rights to me, and your next child right arm.