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
1 changed files with 8 additions and 1 deletions

View File

@ -196,11 +196,18 @@ func AddTemplateExt(ext string) {
}
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{
root: dir,
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)
})
if err != nil {