mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 20:10:56 +00:00
add exist
This commit is contained in:
parent
3d47cd0a40
commit
d0e171c801
12
template.go
12
template.go
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user