Browse Source

Made check for static template bundle option, also check to see if the template bundle file exists when gathering cog templates

Wirecog, LLC 3 years ago
parent
commit
2b63272cc1
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      templateset.go

+ 6
- 2
templateset.go View File

@@ -175,7 +175,7 @@ func (t *TemplateSet) GatherTemplates() {
175 175
 	if UseStaticTemplateBundleFile == true {
176 176
 		err := t.RestoreTemplateBundleFromDisk()
177 177
 		if err != nil {
178
-			log.Println("Failed to restore template bundle from disk, opting for standard operating procedure instead. Error: ", err)
178
+			log.Println("Detected initial run. Will generate a template bundle file.")
179 179
 		} else {
180 180
 			return
181 181
 		}
@@ -203,7 +203,11 @@ func (t *TemplateSet) GatherTemplates() {
203 203
 func (t *TemplateSet) GatherCogTemplates(cogTemplatePath string, prefixName string, templateFileExtension string) {
204 204
 
205 205
 	if UseStaticTemplateBundleFile == true {
206
-		return
206
+		if _, err := os.Stat(StaticTemplateBundleFilePath); os.IsNotExist(err) {
207
+			log.Println("Detected initial run. Will generate a template bundle file.")
208
+		} else {
209
+			return
210
+		}
207 211
 	}
208 212
 
209 213
 	bundle := NewTemplateBundle()