当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 0

Simbory / mego
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
toplFile.go 794 Bytes
一键复制 编辑 原始数据 按行查看 历史
package mego
import (
"html/template"
"os"
"path/filepath"
"strings"
)
type tplCache struct {
tpl *template.Template
err error
}
type tplFile struct {
viewExt string
files map[string][]string
}
func (vf *tplFile) visit(paths string, f os.FileInfo, err error) error {
if f == nil {
return err
}
if f.IsDir() || (f.Mode()&os.ModeSymlink) > 0 {
return nil
}
if !strings.HasSuffix(strings.ToLower(paths), vf.viewExt) {
return nil
}
replace := strings.NewReplacer("\\", "/")
a := []byte(paths)
a = a[0:]
file := strings.TrimLeft(replace.Replace(string(a)), "/")
subDir := filepath.Dir(file)
if _, ok := vf.files[subDir]; ok {
vf.files[subDir] = append(vf.files[subDir], file)
} else {
m := make([]string, 1)
m[0] = file
vf.files[subDir] = m
}
return nil
}
Go
1
https://gitee.com/simbory/mego.git
git@gitee.com:simbory/mego.git
simbory
mego
mego
v1.1.1

搜索帮助