Update template assets.
This commit is contained in:
parent
46e47c4ef7
commit
b740896359
@ -1,6 +1,6 @@
|
|||||||
// +build embed
|
// +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.
|
// please avoid editting this file as it might be regenerated again.
|
||||||
|
|
||||||
package assettemplates
|
package assettemplates
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// +build !embed
|
// +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.
|
// please avoid editting this file as it might be regenerated again.
|
||||||
|
|
||||||
package assettemplates
|
package assettemplates
|
||||||
@ -15,19 +15,34 @@ func Asset(path string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AssetDir(dir string) (map[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 {
|
if e != nil {
|
||||||
return nil, e
|
return nil, e
|
||||||
}
|
}
|
||||||
|
|
||||||
files := make(map[string][]byte)
|
for _, f := range files {
|
||||||
for _, f := range tmp {
|
fpath := filepath.Join(d, f.Name())
|
||||||
name := filepath.Join(dir, f.Name())
|
|
||||||
body, e := ioutil.ReadFile(name)
|
if f.IsDir() {
|
||||||
|
dirs = append(dirs, fpath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !f.Mode().IsRegular() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fbody, e := ioutil.ReadFile(fpath)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, e
|
return nil, e
|
||||||
}
|
}
|
||||||
files[name] = body
|
list[fpath] = fbody
|
||||||
}
|
}
|
||||||
return files, nil
|
}
|
||||||
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user