1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 22:00:49 +00:00

add exist

This commit is contained in:
astaxie 2013-03-21 21:45:48 +08:00
parent 3d47cd0a40
commit d0e171c801

View File

@ -196,12 +196,12 @@ 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")
if _, err := os.Stat(dir); err != nil {
if os.IsNotExist(err) {
return err
} else {
return errors.New("dir open err")
}
}
self := templatefile{
root: dir,