From 11cb55232a766457ce3ea9c0643506346b5aab81 Mon Sep 17 00:00:00 2001 From: Matt Hazinski Date: Fri, 25 Sep 2015 22:03:14 -0400 Subject: [PATCH] Make filesDir if it does not exist --- server.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 5145e0b..eeb8bb9 100644 --- a/server.go +++ b/server.go @@ -6,6 +6,8 @@ import ( "net" "net/http" "regexp" + "os" + "fmt" "github.com/flosch/pongo2" "github.com/zenazn/goji" @@ -37,7 +39,12 @@ func main() { goji.Abandon(middleware.Logger) } - // check trailing slashes + // make directory if needed + err := os.MkdirAll(Config.filesDir, 0755) + if err != nil { + fmt.Printf("Error: could not create files directory") + os.exit(1) + } // Template Globals pongo2.DefaultSet.Globals["sitename"] = Config.siteName