Browse Source

Made pathing platform agnostic

Wirecog 6 years ago
parent
commit
56e9b878b1
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      templatebundle.go

+ 2
- 2
templatebundle.go View File

58
 func (t *TemplateBundle) importTemplateFileContentsForCog(templatesPath string, prefixName string, templateFileExtension string) error {
58
 func (t *TemplateBundle) importTemplateFileContentsForCog(templatesPath string, prefixName string, templateFileExtension string) error {
59
 
59
 
60
 	templateDirectory := filepath.Clean(templatesPath)
60
 	templateDirectory := filepath.Clean(templatesPath)
61
-	RegisterStaticAssetsSearchPath(strings.Replace(templateDirectory, "/templates", "", -1))
61
+	RegisterStaticAssetsSearchPath(strings.Replace(templateDirectory, string(os.PathSeparator)+"templates", "", -1))
62
 	//println("td: ", templateDirectory)
62
 	//println("td: ", templateDirectory)
63
 	if err := filepath.Walk(templateDirectory, func(path string, info os.FileInfo, err error) error {
63
 	if err := filepath.Walk(templateDirectory, func(path string, info os.FileInfo, err error) error {
64
 		if strings.HasSuffix(path, templateFileExtension) {
64
 		if strings.HasSuffix(path, templateFileExtension) {
65
 			name := strings.TrimSuffix(strings.TrimPrefix(path, templateDirectory+string(os.PathSeparator)), TemplateFileExtension)
65
 			name := strings.TrimSuffix(strings.TrimPrefix(path, templateDirectory+string(os.PathSeparator)), TemplateFileExtension)
66
-			name = prefixName + "/" + name
66
+			name = filepath.Join(prefixName, name)
67
 			contents, err := ioutil.ReadFile(path)
67
 			contents, err := ioutil.ReadFile(path)
68
 			t.items[name] = string(contents)
68
 			t.items[name] = string(contents)
69
 
69