From 9fefe31b0df1c04b408c5e54e8b0912acb26c292 Mon Sep 17 00:00:00 2001 From: itsMontoya Date: Tue, 28 Mar 2017 12:32:59 -0700 Subject: [PATCH] Adding the creation of output dirs --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index cb6d46e..46032fe 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "net/http" "os" + "path" "strings" "github.com/cheekybits/genny/parse" @@ -62,6 +63,11 @@ func main() { var outWriter io.Writer if len(*out) > 0 { + err := os.MkdirAll(path.Dir(*out), 0755) + if err != nil { + fatal(exitcodeDestFileFailed, err) + } + outFile, err := os.Create(*out) if err != nil { fatal(exitcodeDestFileFailed, err)