pub(crate) fn create_dirs_to_path_if_not_exist(path_to_file: &str) -> Result<(), std::io::Error> {
    if let Some(index) = path_to_file.rfind('/') {
        let dir_path = &path_to_file[..index];
        if !std::path::Path::new(dir_path).exists() {
            fs::create_dir_all(&path_to_file[..index])?;
        }
    }

    Ok(())
}
/// Create dirs to path if not exist.
Create dirs to path if not exist.
Create dirs to path if not exist .
pub(crate) fn create_dirs_to_path_if_not_exist(path_to_file: &str) -> Result<(), std::io::Error> {
    if let Some(index) = path_to_file.rfind('/') {
        let dir_path = &path_to_file[..index];
        if !std::path::Path::new(dir_path).exists() {
            fs::create_dir_all(&path_to_file[..index])?;
        }
    }
    Ok(())
}
pub ( crate ) fn create_dirs_to_path_if_not_exist ( path_to_file : & str ) -> Result < ( ) , std :: io :: Error > { if let Some ( index ) = path_to_file . rfind ( '/' ) { let dir_path = & path_to_file [ .. index ] ; if ! std :: path :: Path :: new ( dir_path ) . exists ( ) { fs :: create_dir_all ( & path_to_file [ .. index ] ) ? ; } } Ok ( ( ) ) }
Create dirs to path if not exist.
Create dirs to path if not exist .
path_to_file
&str
path_to_file
&str