truncate in save_to_file

This commit is contained in:
alex 2025-12-25 22:04:14 +08:00
parent 4161dd8df8
commit 8e93a4224b

View File

@ -63,6 +63,7 @@ pub fn save_to_file(idfile: &str, content: &str) -> Result<()> {
OpenOptions::new() OpenOptions::new()
.create(true) .create(true)
.write(true) .write(true)
.truncate(true)
.open(filepath)? .open(filepath)?
.write_all(content.as_bytes())?; .write_all(content.as_bytes())?;
Ok(()) Ok(())