thirdshift 0.11.2

Turn a GitHub issue into a ready-for-review pull request, unattended
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Stateless Command log file effects. The recording owner decides its
//! path, held lines, lifetime and warning policy.

use std::fs::{self, File};
use std::path::Path;

use anyhow::{Context, Result};

pub(super) fn open(path: &Path) -> Result<File> {
    if let Some(dir) = path.parent() {
        fs::create_dir_all(dir).with_context(|| format!("could not create {}", dir.display()))?;
    }
    File::create(path).with_context(|| format!("could not create {}", path.display()))
}