Skip to content

Commit

Permalink
don't choke if version specific output directories already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
benmaddison committed May 21, 2023
1 parent 5d816d1 commit 44c1a73
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::env;
use std::error::Error;
use std::fs;
use std::io;
use std::path::PathBuf;

use glob::glob;
Expand Down Expand Up @@ -28,7 +29,10 @@ impl JunosVersion {
let path = env::var("OUT_DIR")
.map(PathBuf::from)
.map(|base| base.join(format!("junos_{}_{}", self.major, self.minor)))?;
fs::create_dir(&path)?;
fs::create_dir(&path).or_else(|err| match err.kind() {
io::ErrorKind::AlreadyExists => Ok(()),
_ => Err(err),
})?;
Ok(path)
}

Expand Down

0 comments on commit 44c1a73

Please sign in to comment.