3d47cd0a by astaxie

add just wheather the view is a dir

1 parent b54fc102
...@@ -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 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!