add just wheather the view is a dir
Showing
1 changed file
with
8 additions
and
1 deletions
| ... | @@ -196,11 +196,18 @@ func AddTemplateExt(ext string) { | ... | @@ -196,11 +196,18 @@ func AddTemplateExt(ext string) { |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | func BuildTemplate(dir string) error { | 198 | func BuildTemplate(dir string) error { |
| 199 | f, err := os.Stat(dir) | ||
| 200 | if err != nil { | ||
| 201 | return err | ||
| 202 | } | ||
| 203 | if !f.IsDir() { | ||
| 204 | return errors.New("is not dir") | ||
| 205 | } | ||
| 199 | self := templatefile{ | 206 | self := templatefile{ |
| 200 | root: dir, | 207 | root: dir, |
| 201 | files: make(map[string][]string), | 208 | files: make(map[string][]string), |
| 202 | } | 209 | } |
| 203 | err := filepath.Walk(dir, func(path string, f os.FileInfo, err error) error { | 210 | err = filepath.Walk(dir, func(path string, f os.FileInfo, err error) error { |
| 204 | return self.visit(path, f, err) | 211 | return self.visit(path, f, err) |
| 205 | }) | 212 | }) |
| 206 | if err != nil { | 213 | if err != nil { | ... | ... |
-
Please register or sign in to post a comment