fix(flatmap): create output file if it doesn't exist

This commit is contained in:
Wataru Otsubo 2025-04-21 21:39:06 +09:00
parent b492d097e7
commit 2accbc3910

View file

@ -99,7 +99,11 @@ pub fn generate_flatmap(xml: &path::Path, out: Option<&path::Path>) -> Result<()
}
let f: Box<dyn Write> = match out {
Some(f) => {
let file = File::options().write(true).truncate(true).open(f)?;
let file = File::options()
.create(true)
.write(true)
.truncate(true)
.open(f)?;
Box::new(BufWriter::new(file))
}
None => Box::new(io::stdout()),