Update template assets.

This commit is contained in:
A. Svensson 2016-05-03 18:47:15 +02:00
parent 46e47c4ef7
commit b740896359
2 changed files with 61 additions and 46 deletions

View File

@ -1,6 +1,6 @@
// +build embed
// Automagically generated by yaber v0.1 (https://github.com/lmas/yaber),
// Automagically generated by yaber v0.2 (https://github.com/lmas/yaber),
// please avoid editting this file as it might be regenerated again.
package assettemplates

View File

@ -1,6 +1,6 @@
// +build !embed
// Automagically generated by yaber v0.1 (https://github.com/lmas/yaber),
// Automagically generated by yaber v0.2 (https://github.com/lmas/yaber),
// please avoid editting this file as it might be regenerated again.
package assettemplates
@ -15,19 +15,34 @@ func Asset(path string) ([]byte, error) {
}
func AssetDir(dir string) (map[string][]byte, error) {
tmp, e := ioutil.ReadDir(dir)
list := make(map[string][]byte)
dirs := []string{dir}
for len(dirs) > 0 {
d := dirs[0]
dirs = dirs[1:]
files, e := ioutil.ReadDir(d)
if e != nil {
return nil, e
}
files := make(map[string][]byte)
for _, f := range tmp {
name := filepath.Join(dir, f.Name())
body, e := ioutil.ReadFile(name)
for _, f := range files {
fpath := filepath.Join(d, f.Name())
if f.IsDir() {
dirs = append(dirs, fpath)
continue
}
if !f.Mode().IsRegular() {
continue
}
fbody, e := ioutil.ReadFile(fpath)
if e != nil {
return nil, e
}
files[name] = body
list[fpath] = fbody
}
return files, nil
}
return list, nil
}