cs2_nav/utils.rs
1use std::{fs::File, path::Path};
2
3/// Create a file with all its parent directories.
4///
5/// # Panics
6///
7/// Panics if the file cannot be created.
8#[must_use]
9pub fn create_file_with_parents(path: &Path) -> File {
10 if let Some(parent) = path.parent() {
11 std::fs::create_dir_all(parent).unwrap();
12 }
13
14 File::create(path).unwrap()
15}