Skip to content

Commit

Permalink
fix(codegen): create output directory if it doesn't exist (#3389)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 authored Jul 8, 2024
1 parent a579bf7 commit 76da70e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xtask/codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ pub fn update(path: &Path, contents: &str, mode: &Mode) -> Result<UpdateResult>
}

eprintln!("updating {}", path.display());
if let Some(parent) = path.parent() {
if !parent.exists() {
fs2::create_dir_all(parent)?;
}
}
fs2::write(path, contents)?;
Ok(UpdateResult::Updated)
}
Expand Down

0 comments on commit 76da70e

Please sign in to comment.