use a standard Base62 library for slug generation, attempt to create output directory if it doesn't exist

This commit is contained in:
Amrit Panesar committed 2017-12-28 19:46:22 -08:00
1 parent a7e5e803cf
commit d9c4c90936
4 files changed
+71 -69

No files matched your search

+13
View File
@@ -2,6 +2,7 @@ package main
import (
"fmt"
"log"
"os"
"github.com/spf13/pflag"
@@ -46,4 +47,16 @@ func init() {
} else {
viper.Set("uriprefix", "http")
}
_, err := os.Stat(viper.GetString("output"))
if err != nil {
log.Printf("unable to stat() output directory: %s\n", viper.GetString("output"))
log.Printf("attempting to create %s\n", viper.GetString("output"))
err = os.Mkdir(viper.GetString("output"), os.ModeDir)
if err != nil {
log.Printf("Unable to create directory %s\n", viper.GetString("output"))
log.Fatalf("System error: %s\n", err)
os.Exit(1)
}
}
}