use create_dir_all instead of create_dir as that doesn't fail if the directory already exists, and make sure to propagate the error out

pull/306/head
Alexander Kjäll 2023-01-27 21:11:20 +01:00 committed by andy.boot
parent fdbed14334
commit 712acc67fe
1 changed files with 4 additions and 4 deletions

View File

@ -1,8 +1,8 @@
use clap_complete::{generate_to, shells::*};
use clap_mangen::Man;
use std::fs::File;
use std::io::Error;
use std::path::Path;
use std::fs::File;
use clap_mangen::Man;
include!("src/cli.rs");
@ -18,8 +18,8 @@ fn main() -> Result<(), Error> {
generate_to(Elvish, &mut cmd, app_name, outdir)?;
let file = Path::new("man-page").join("dust.1");
std::fs::create_dir("man-page");
let mut file = File::create(&file)?;
std::fs::create_dir_all("man-page")?;
let mut file = File::create(file)?;
Man::new(cmd).render(&mut file)?;