Skip to main content

create_recursive

Macro create_recursive 

Source
macro_rules! create_recursive {
    ($path:expr) => { ... };
}
Expand description

Takes a &Path and first checks whether it exists or if it is a directory. If it doesn’t exist or is not a directory, it will create the directory recursively; creating the necessary parent directories.

§Example

use sericom_core::create_recursive;
use std::path::PathBuf;
fn mkdir() {
    let path = PathBuf::from("some/dir");
    create_recursive!(&path);
    assert!(path.is_dir() && path.exists());
}