Commit d0e171c8 authored by astaxie's avatar astaxie

add exist

parent 3d47cd0a
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment