Browse Source

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

Wirecog 6 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
 	if UseStaticTemplateBundleFile == true {
175
 	if UseStaticTemplateBundleFile == true {
176
 		err := t.RestoreTemplateBundleFromDisk()
176
 		err := t.RestoreTemplateBundleFromDisk()
177
 		if err != nil {
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
 		} else {
179
 		} else {
180
 			return
180
 			return
181
 		}
181
 		}
203
 func (t *TemplateSet) GatherCogTemplates(cogTemplatePath string, prefixName string, templateFileExtension string) {
203
 func (t *TemplateSet) GatherCogTemplates(cogTemplatePath string, prefixName string, templateFileExtension string) {
204
 
204
 
205
 	if UseStaticTemplateBundleFile == true {
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
 	bundle := NewTemplateBundle()
213
 	bundle := NewTemplateBundle()