1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 20:00:54 +00:00

add just wheather the view is a dir

This commit is contained in:
astaxie 2013-03-21 20:46:54 +08:00
parent b54fc10206
commit 3d47cd0a40

View File

@ -196,11 +196,18 @@ func AddTemplateExt(ext string) {
} }
func BuildTemplate(dir string) error { func BuildTemplate(dir string) error {
f, err := os.Stat(dir)
if err != nil {
return err
}
if !f.IsDir() {
return errors.New("is not dir")
}
self := templatefile{ self := templatefile{
root: dir, root: dir,
files: make(map[string][]string), files: make(map[string][]string),
} }
err := filepath.Walk(dir, func(path string, f os.FileInfo, err error) error { err = filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {
return self.visit(path, f, err) return self.visit(path, f, err)
}) })
if err != nil { if err != nil {