rapx/utils/
fs.rs

1use crate::utils::log::rap_error_and_exit;
2
3use std::fs;
4use std::path::Path;
5
6pub fn rap_create_file<P: AsRef<Path>>(path: P, msg: impl AsRef<str>) -> fs::File {
7    match fs::File::create(path) {
8        Ok(file) => file,
9        Err(e) => rap_error_and_exit(format!("{}: {}", msg.as_ref(), e)),
10    }
11}