Skip to content

Commit

Permalink
create dir before writing file (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodaine authored Nov 22, 2018
1 parent 95ca57a commit 78210b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion protoc-gen-debug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ func main() {
log.Fatal(`please execute the plugin with the output path to properly write the output file: --debug_out="{PATH}:{PATH}"`)
}

err = os.MkdirAll(path, 0755)
if err != nil {
log.Fatal("unable to create output dir: ", err)
}

err = ioutil.WriteFile(filepath.Join(path, "code_generator_request.pb.bin"), data, 0644)
if path == "" {
if err != nil {
log.Fatal("unable to write request to disk: ", err)
}

Expand Down

0 comments on commit 78210b0

Please sign in to comment.