~goorzhel/radm

e1299bf8c3ce1049bd7d2822d788e83d5451d6e1 — Antonio Gurgel 3 months ago aeb5136
Ditch separator goofiness for 'rstdm-std*.log.old'

This brings rstdm more in line with programs like X (`Xorg.0.old`).
1 files changed, 7 insertions(+), 11 deletions(-)

M src/user.rs
M src/user.rs => src/user.rs +7 -11
@@ 90,20 90,16 @@ impl User {
        let open = |file: &str| -> Result<File> {
            let mut path = path.clone();
            path.push(file);
            let mut file = std::fs::OpenOptions::new()
                .append(true)
            if path.exists() {
                let mut old = path.clone();
                old.set_extension("old");
                std::fs::rename(&path, old)?;
            }
            let file = std::fs::OpenOptions::new()
                .write(true)
                .create(true)
                .open(&path)
                .with_context(|| anyhow!("Failed to open {}", &path.to_string_lossy()))?;
            // I wanted to write a timestamp here but the size:utility ratio of chronos was too
            // high. If I find more occasions to use timestamps, I'll come back to this.
            file.write_all(b"rstdm-----rstdm-----rstdm-----rstdm-----rstdm\n")
                .with_context(|| {
                    anyhow!(
                        "Got handle on {} but failed to write to it",
                        path.to_string_lossy()
                    )
                })?;
            Ok(file)
        };