6fbdbaae by miraclesu

Refactor template

1 parent 5ccdaeb0
Showing 1 changed file with 12 additions and 11 deletions
......@@ -51,19 +51,13 @@ func (self *templatefile) visit(paths string, f os.FileInfo, err error) error {
if f == nil {
return err
}
if f.IsDir() {
if f.IsDir() || (f.Mode()&os.ModeSymlink) > 0 {
return nil
} else if (f.Mode() & os.ModeSymlink) > 0 {
return nil
} else {
hasExt := false
for _, v := range BeeTemplateExt {
if strings.HasSuffix(paths, v) {
hasExt = true
break
}
if !HasTemplateEXt(paths) {
return nil
}
if hasExt {
replace := strings.NewReplacer("\\", "/")
a := []byte(paths)
a = a[len([]byte(self.root)):]
......@@ -76,9 +70,16 @@ func (self *templatefile) visit(paths string, f os.FileInfo, err error) error {
self.files[subdir] = m
}
return nil
}
func HasTemplateEXt(paths string) bool {
for _, v := range BeeTemplateExt {
if strings.HasSuffix(paths, "."+v) {
return true
}
}
return nil
return false
}
func AddTemplateExt(ext string) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!