Skip to content

Commit

Permalink
Serialize to disk if descriptor path is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Apr 8, 2022
1 parent d6217d2 commit 1f8baa2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion prost-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,15 @@ impl Config {

#[cfg(feature = "vendored")]
if protoc() == Path::new("linked") {
return Self::serialize_file_descriptor_set(protos, includes);
let file_descriptor_set = Self::serialize_file_descriptor_set(protos, includes)?;

// If the user has set the file descriptor path manually then also save it
// to disk in case they are counting on that behavior
if let Some(path) = &self.file_descriptor_set_path {
std::fs::write(path, &file_descriptor_set)?;
}

return Ok(file_descriptor_set);
}

let tmp;
Expand Down

0 comments on commit 1f8baa2

Please sign in to comment.