339 lines
20 KiB
Go
339 lines
20 KiB
Go
|
// Code generated by go-bindata.
|
||
|
// sources:
|
||
|
// static/css/main.css
|
||
|
// static/css/normalize.css
|
||
|
// templates/edit.tmpl
|
||
|
// templates/footer.tmpl
|
||
|
// templates/header.tmpl
|
||
|
// DO NOT EDIT!
|
||
|
|
||
|
package assets
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"compress/gzip"
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"strings"
|
||
|
"os"
|
||
|
"time"
|
||
|
"io/ioutil"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
||
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||
|
}
|
||
|
|
||
|
var buf bytes.Buffer
|
||
|
_, err = io.Copy(&buf, gz)
|
||
|
clErr := gz.Close()
|
||
|
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||
|
}
|
||
|
if clErr != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return buf.Bytes(), nil
|
||
|
}
|
||
|
|
||
|
type asset struct {
|
||
|
bytes []byte
|
||
|
info os.FileInfo
|
||
|
}
|
||
|
|
||
|
type bindataFileInfo struct {
|
||
|
name string
|
||
|
size int64
|
||
|
mode os.FileMode
|
||
|
modTime time.Time
|
||
|
}
|
||
|
|
||
|
func (fi bindataFileInfo) Name() string {
|
||
|
return fi.name
|
||
|
}
|
||
|
func (fi bindataFileInfo) Size() int64 {
|
||
|
return fi.size
|
||
|
}
|
||
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||
|
return fi.mode
|
||
|
}
|
||
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||
|
return fi.modTime
|
||
|
}
|
||
|
func (fi bindataFileInfo) IsDir() bool {
|
||
|
return false
|
||
|
}
|
||
|
func (fi bindataFileInfo) Sys() interface{} {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var _staticCssMainCss = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
|
||
|
|
||
|
func staticCssMainCssBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_staticCssMainCss,
|
||
|
"static/css/main.css",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func staticCssMainCss() (*asset, error) {
|
||
|
bytes, err := staticCssMainCssBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "static/css/main.css", size: 0, mode: os.FileMode(436), modTime: time.Unix(1442136876, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
var _staticCssNormalizeCss = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x59\x61\x8f\xdb\x36\x12\xfd\xee\x5f\xc1\xa6\x28\x92\xec\xd9\x5e\xef\xa6\x69\x7b\xde\xeb\x87\x20\x4d\xae\x41\xd3\xe6\xd0\xe4\x70\x07\x04\x0b\x88\x92\x68\x9b\xb7\x92\x28\x88\x94\x77\x9d\xbb\xfb\xef\xf7\x66\x48\xca\x92\x2d\x6f\x52\xe0\x36\x01\x76\xbd\x12\x39\x1c\x0e\xe7\xbd\x79\x43\x9f\x9f\x7d\x25\x2a\xd3\x94\xb2\xd0\x9f\xd4\x3c\xb3\x56\x6c\x9f\xcd\x17\xf3\x4b\xf1\x1f\xf1\xeb\x9b\x0f\xe2\xad\xce\x54\x65\x15\xfe\x5a\x6b\x37\xd7\xe6\xbc\x1b\x2b\xce\xce\x27\x93\xf3\xb3\xb3\x89\x38\x13\x17\x73\xf1\x5e\x39\x91\xab\x95\x6c\x0b\x27\x56\xa6\xc2\x0f\x59\xea\x62\x27\x9c\x11\x56\x56\x76\x66\x55\xa3\x57\x73\x1a\x7c\x39\x17\x7f\x6b\xd4\x56\x61\x8c\x7e\xf7\x5e\x38\x75\xe7\x84\x25\x83\x32\xff\x57\x6b\x9d\x90\x2b\xa7\x1a\x61\x1a\x8d\x11\xd2\x69\x53\x89\x6c\x23\xab\xb5\x9a\x8a\x5b\xed\x36\xa6\xc5\x3a\xda\xca\xb4\xd0\xd5\x9a\xcc\xe1\x5f\x0b\xe3\xe2\x93\x31\x25\xd9\x87\x57\x1b\x57\x16\xe2\xdf\x13\xc1\x8e\xcc\xbc\x23\xcb\x9e\x1b\x57\xe2\x1c\x3e\xd3\x50\x21\x66\xa5\x9d\x91\x0b\x33\x72\x61\xe6\x5d\x58\x8a\x8b\xc5\xe2\x1b\x1e\x75\x19\x46\xdd\xaa\xf4\x46\xbb\xcf\x8e\xfc\x6f\x17\x92\xdf\x55\x69\xb6\xaa\x0b\x49\x29\x9b\xb5\xae\x82\x7f\xa9\xc9\x77\xec\x9f\x7f\xba\x14\x8b\x2b\x3f\x53\xfc\xfc\xe1\xd7\xb7\xcf\x69\x7f\x75\x21\x77\x34\x59\x57\x9a\x42\x60\x31\x58\xfc\xf8\x7f\xfb\xd7\x3f\xbb\x97\xa6\x69\x54\xe6\x44\x92\x16\x26\xbb\x49\xba\xc5\x2b\xe3\xbc\x03\x2a\x47\x1c\x1b\x21\xab\x5d\x70\x4f\x15\xaa\xe4\xd3\xab\xc4\x9b\x57\xe2\x87\xf3\x3f\xcf\xff\x88\x9d\x24\x57\x4e\xea\xc2\x26\x82\xfe\xb0\x6d\x89\x20\xec\x92\x60\xec\x62\x71\x7e\x71\x41\xd6\x64\x95\x8b\xd7\xba\x51\x2b\x73\xf7\xc7\xac\x97\x52\x57\x9d\xb5\x8b\x10\x70\xd9\x38\x9d\x15\x6a\x3a\x91\x56\xe7\xf8\x15\x5c\x98\x4e\x56\x7a\x9d\xc9\x9a\x22\xcc\x9f\xdb\x06\x2f\x57\xc6\x20\x01\xa7\x93\x8d\x92\x39\xff\x5e\x37\xa6\xad\xa7\x13\xb2\x8c\x9f\xaa\x6a\xa7\x93\x4a\x6e\xa7\x13\x0b\x87\x78\x66\xd8\x04\x1f\x69\x70\x6c\x29\xd8\xd1\xab\x5e\x46\x00\x24\xdd\x2e\x74\x85\xf4\x55\xb3\x7b\x36\x33\x0c\x2e\x30\xf3\x5b\x07\xbc\xad\xa2\xed\xc8\x42\xe0\xcf\x75\xc5\x47\x61\x56\x22\xa9\x1b\xb3\x6e\x94\xb5\xbc\xfb\x97\x9b\xc6\x94\x80\x4c\x88\xe1\x94\x03\xfa\xae\x56\x8d\x8c\x21\x69\x73\x6d\xa6\x93\x4c\x56\x5b\x89\x40\xc4\xc9\xd3\xc9\x16\x11\x32\xc3\xad\xf4\xbd\xed\x63\x27\x3a\x32\x63\x47\xb0\x65\x69\x15\x8d\x1c\xc3\x43\x84\x7c\x69\x10\xd4\x4a\xa4\x8d\xb9\x05\x16\xad\x58\xc1\xcf\xb8\x12\x10\x2d\x12\x76\x2c\xe9\xb0\x9e\x01\xc2\x8d\x29\xec\xbc\x07\x2a\x75\x97\xc1\x55\xb1\x51\x7a\xbd\xe1\x34\x24\x1e\x01\x6c\xd4\x16\x6c\x65\xfb\x1b\x5c\x22\xa4\x4f\x3e\x46\x1b\xd7\x4f\x87\xfb\xaa\x0c\x7c\xc5\x03\x6f\x68\x0f\x43\x76\xf8\x45\x9e\x53\x40\x44\xf2\x71\xa3\xf3\x5c\x55\xd7\x89\xb0\x6e\x47\xac\xc3\xe7\x54\xe3\xe5\x00\x04\xe7\x17\x0b\xf6\xf1\x67\xc4\x4f\xb8\x8d\x12\x89\x53\x25\xd6\x71\x2a\x39\x46\x0c\xb2\x7c\x2a\xde\xcb\x95\x6c\xf4\xb4\x9f\xeb\xe2\x2f\xe2\xf2\x32\x6c\x20\xae\x3b\x9d\x44\x43\x63\xde\x7b\xde\x78\xab\xab\x9b\x07\xe4\x88\x10\x77\xda\xd5\xba\x41\xa2\xa6\x32\xbb\x21\x54\xc0\xf1\xcc\x14\x80\x1d\x9f\xa2\x04\x1c\x30\xaa\x20\x5f\x3a\x3c\xc7\xd3\x60\xdf\xf7\xf3\x66\x3c\x6f\x29\x5c\x03\x56\xae\x65\x83\xe8\xf4\x83\xff\xa6\x44\x42\xc2\x56\x03\x0c\xca\x54\x17\xda\xed\xc4\xed\x46\x55\xc0\x78\x06\xb6\xcf\x39\x66\xb2\xb0\x06\xf9\x84\xbf\xc5\x06\x83\x1b\x8f\x1a\x59\x14\x5d\x76\xc5\xc5\x97\xde\x35\xe0\x7f\xc9\x23\xd9\x19\x64\x17\x25\x6b\x8f\x7d\x3f\x10\xbb\x17\xc8\xd3\x42\x58\x55\xca\x0a\xc9\xfd\x80\x41\x8d\x09\xf6\xb9\xac\x3a\xca\x15\x8f\xed\xb8\xb7\x34\x6d\x3e\x3a\xed\x0a\x75\xed\x43\x6c\x1a\x00\x6c\x96\x1a\xe7\x4c\x89\xf2\x54\xdf\x89\x1c\x9f\x55\x3e\x96\xdb\xb4\xb4\xc2\x5e\x1d\x95\xe9\x24\x35\x05\xa6\x32\x7d\xc4\x74\xfc\xf6\x4f\xf7\x2c\x9d\x82\xf9\x80\x2b\xb8\xde\xd5\xda\xdb\x80\x24\x32\x75\x6a\xc1\x91\xbd\xfa\x25\x8e\x57\xc8\x57\xd5\xde\x36\x3b\x0b\x32\x72\x60\x9b\x6c\xcc\xf8\x16\x36\xa0\x0b\x80\xbc\xcd\x45\x12\xe6\xb0\xae\x80\x59\x5f\x69\x99\x55\xf0\x2b\x09\xd4\x9d\xf0\xbb\x24\x94\x87\x84\x8c\x11\x57\x20\x0d\xec\x17\x47\x61\x73\xd1\x73\x11\xcb\x2d\xc5\xa5\x2a\xaf\xfa\xc5\x7d\xfe\xdd\xf7\xaa\x1c\x27\x97\x7b\xcf\x3e\x2c\x00\x3b\x37\x07\xe8\x59\x8a\xaf\x57\xab\x05\x
|
||
|
|
||
|
func staticCssNormalizeCssBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_staticCssNormalizeCss,
|
||
|
"static/css/normalize.css",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func staticCssNormalizeCss() (*asset, error) {
|
||
|
bytes, err := staticCssNormalizeCssBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "static/css/normalize.css", size: 7798, mode: os.FileMode(436), modTime: time.Unix(1442136889, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
var _templatesEditTmpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xaa\xae\x56\xf6\x70\x75\x74\x71\x0d\x52\xae\xad\xe5\xe2\xb2\x29\x49\xad\x28\x49\x2c\x4a\x4d\xb4\xab\xae\x56\xd0\x73\xca\x4f\xa9\xd4\x0b\x4b\x2c\x32\x54\xa8\xad\xb5\xd1\x87\x4b\x71\x71\x01\x35\xb9\xf9\xfb\x87\x40\x34\x01\x02\x00\x00\xff\xff\x60\x7d\x92\x18\x42\x00\x00\x00")
|
||
|
|
||
|
func templatesEditTmplBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_templatesEditTmpl,
|
||
|
"templates/edit.tmpl",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func templatesEditTmpl() (*asset, error) {
|
||
|
bytes, err := templatesEditTmplBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "templates/edit.tmpl", size: 66, mode: os.FileMode(436), modTime: time.Unix(1442142830, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
var _templatesFooterTmpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb2\x49\xcb\xcf\x2f\x49\x2d\xb2\xe3\xe2\xb2\xd1\x87\x31\x6d\xf4\x93\xf2\x53\x2a\x41\x74\x46\x49\x6e\x8e\x1d\x17\x20\x00\x00\xff\xff\x61\xeb\xb2\x38\x24\x00\x00\x00")
|
||
|
|
||
|
func templatesFooterTmplBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_templatesFooterTmpl,
|
||
|
"templates/footer.tmpl",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func templatesFooterTmpl() (*asset, error) {
|
||
|
bytes, err := templatesFooterTmplBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "templates/footer.tmpl", size: 36, mode: os.FileMode(436), modTime: time.Unix(1442138891, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
var _templatesHeaderTmpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x90\x31\x4f\xc3\x30\x10\x85\xf7\xfe\x0a\x63\x56\xdc\x88\x8d\x21\x8e\x84\x4a\x07\x26\x18\x8a\x04\xa3\xeb\xbc\xd4\x07\x67\xbb\xc4\xd7\x56\xa5\xea\x7f\x27\xa1\x02\x15\x89\x89\xc9\xdf\xf9\xde\x7b\x3a\xbd\xfa\xe2\xee\x61\xb6\x78\x79\x9c\xab\x20\x91\x9b\x49\x3d\x3e\xca\xb3\x2b\xc5\xea\x94\xcd\x6b\xd1\x8a\x5d\x5a\x59\x8d\xa4\x9b\x89\x52\x75\x80\x6b\x47\x18\x30\x42\x9c\xf2\xc1\xf5\x05\x62\xf5\x46\x3a\x73\xa3\xcf\x57\x41\x64\x6d\xf0\xbe\xa1\xad\xd5\xcf\xe6\xe9\xd6\xcc\x72\x5c\x3b\xa1\x25\x43\x2b\x9f\x93\x20\x0d\xbe\xfb\xb9\x45\xbb\xc2\x2f\x67\x72\x11\x56\x6f\x09\xbb\x75\xee\xe5\x4c\xbc\xa3\x56\x82\x6d\xb1\x25\x0f\xf3\x35\x5c\x29\x4a\x24\xe4\xd8\x14\xef\x18\xf6\xfa\x8f\x20\x09\x88\x30\x3e\x73\xee\xcf\xb2\x2e\xbb\xae\xfb\x16\x0b\x09\xa3\x39\x1c\xd4\x74\x31\x92\x3a\x1e\xeb\xea\xf4\x77\xda\x33\xa5\x37\xd5\x83\xad\x2e\xb2\x67\x94\x00\x0c\x67\x85\x1e\x9d\xd5\x95\x6b\x23\xa5\x6a\xa8\x0c\x52\x2a\x5f\x4a\x95\x72\x1f\x1d\xd3\x07\xa6\xc3\xa4\xff\x15\x11\x1d\xa5\x1f\x77\x5d\x9d\x5a\x1f\x71\x99\xdb\x7d\x33\xf9\x0c\x00\x00\xff\xff\xf3\xee\xa9\xf9\xb8\x01\x00\x00")
|
||
|
|
||
|
func templatesHeaderTmplBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_templatesHeaderTmpl,
|
||
|
"templates/header.tmpl",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func templatesHeaderTmpl() (*asset, error) {
|
||
|
bytes, err := templatesHeaderTmplBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "templates/header.tmpl", size: 440, mode: os.FileMode(436), modTime: time.Unix(1442141496, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
// Asset loads and returns the asset for the given name.
|
||
|
// It returns an error if the asset could not be found or
|
||
|
// could not be loaded.
|
||
|
func Asset(name string) ([]byte, error) {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||
|
a, err := f()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||
|
}
|
||
|
return a.bytes, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
|
||
|
// MustAsset is like Asset but panics when Asset would return an error.
|
||
|
// It simplifies safe initialization of global variables.
|
||
|
func MustAsset(name string) []byte {
|
||
|
a, err := Asset(name)
|
||
|
if (err != nil) {
|
||
|
panic("asset: Asset(" + name + "): " + err.Error())
|
||
|
}
|
||
|
|
||
|
return a
|
||
|
}
|
||
|
|
||
|
// AssetInfo loads and returns the asset info for the given name.
|
||
|
// It returns an error if the asset could not be found or
|
||
|
// could not be loaded.
|
||
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||
|
a, err := f()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||
|
}
|
||
|
return a.info, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||
|
}
|
||
|
|
||
|
// AssetNames returns the names of the assets.
|
||
|
func AssetNames() []string {
|
||
|
names := make([]string, 0, len(_bindata))
|
||
|
for name := range _bindata {
|
||
|
names = append(names, name)
|
||
|
}
|
||
|
return names
|
||
|
}
|
||
|
|
||
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||
|
var _bindata = map[string]func() (*asset, error){
|
||
|
"static/css/main.css": staticCssMainCss,
|
||
|
"static/css/normalize.css": staticCssNormalizeCss,
|
||
|
"templates/edit.tmpl": templatesEditTmpl,
|
||
|
"templates/footer.tmpl": templatesFooterTmpl,
|
||
|
"templates/header.tmpl": templatesHeaderTmpl,
|
||
|
}
|
||
|
|
||
|
// AssetDir returns the file names below a certain
|
||
|
// directory embedded in the file by go-bindata.
|
||
|
// For example if you run go-bindata on data/... and data contains the
|
||
|
// following hierarchy:
|
||
|
// data/
|
||
|
// foo.txt
|
||
|
// img/
|
||
|
// a.png
|
||
|
// b.png
|
||
|
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||
|
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||
|
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||
|
// AssetDir("") will return []string{"data"}.
|
||
|
func AssetDir(name string) ([]string, error) {
|
||
|
node := _bintree
|
||
|
if len(name) != 0 {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
pathList := strings.Split(cannonicalName, "/")
|
||
|
for _, p := range pathList {
|
||
|
node = node.Children[p]
|
||
|
if node == nil {
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if node.Func != nil {
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
rv := make([]string, 0, len(node.Children))
|
||
|
for childName := range node.Children {
|
||
|
rv = append(rv, childName)
|
||
|
}
|
||
|
return rv, nil
|
||
|
}
|
||
|
|
||
|
type bintree struct {
|
||
|
Func func() (*asset, error)
|
||
|
Children map[string]*bintree
|
||
|
}
|
||
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||
|
"static": &bintree{nil, map[string]*bintree{
|
||
|
"css": &bintree{nil, map[string]*bintree{
|
||
|
"main.css": &bintree{staticCssMainCss, map[string]*bintree{
|
||
|
}},
|
||
|
"normalize.css": &bintree{staticCssNormalizeCss, map[string]*bintree{
|
||
|
}},
|
||
|
}},
|
||
|
}},
|
||
|
"templates": &bintree{nil, map[string]*bintree{
|
||
|
"edit.tmpl": &bintree{templatesEditTmpl, map[string]*bintree{
|
||
|
}},
|
||
|
"footer.tmpl": &bintree{templatesFooterTmpl, map[string]*bintree{
|
||
|
}},
|
||
|
"header.tmpl": &bintree{templatesHeaderTmpl, map[string]*bintree{
|
||
|
}},
|
||
|
}},
|
||
|
}}
|
||
|
|
||
|
// RestoreAsset restores an asset under the given directory
|
||
|
func RestoreAsset(dir, name string) error {
|
||
|
data, err := Asset(name)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
info, err := AssetInfo(name)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// RestoreAssets restores an asset under the given directory recursively
|
||
|
func RestoreAssets(dir, name string) error {
|
||
|
children, err := AssetDir(name)
|
||
|
// File
|
||
|
if err != nil {
|
||
|
return RestoreAsset(dir, name)
|
||
|
}
|
||
|
// Dir
|
||
|
for _, child := range children {
|
||
|
err = RestoreAssets(dir, filepath.Join(name, child))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func _filePath(dir, name string) string {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||
|
}
|
||
|
|