123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- // Code generated by go-bindata.
- // sources:
- // .DS_Store
- // BUILD
- // assets.go
- // client.tmpl
- // server.tmpl
- // service.tmpl
- // template.go
- // DO NOT EDIT!
- package templates
- import (
- "bytes"
- "compress/gzip"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
- "time"
- )
- 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 _Ds_store = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xd8\x31\x0a\x02\x31\x10\x85\xe1\x37\x31\x45\xc0\x26\xa5\x65\x1a\x0f\xe0\x0d\xc2\xb2\x9e\xc0\x0b\x58\x78\x05\xfb\x1c\x5d\x96\x79\x60\x60\xd5\x4e\x8c\xcb\xfb\x40\xfe\x05\x37\x2a\x16\x31\x23\x00\x9b\xee\xb7\x13\x90\x01\x24\x78\x71\xc4\x4b\x89\x8f\x95\xd0\x5d\x1b\x5f\x43\x44\x44\x44\xc6\x66\x9e\xb4\xff\xf5\x07\x11\x91\xe1\x2c\xfb\x43\x61\x2b\xdb\xbc\xc6\xe7\x03\x1b\xbb\x35\x99\x2d\x6c\x65\x9b\xd7\x78\x5f\x60\x23\x9b\xd8\xcc\x16\xb6\xb2\xcd\xcb\x4d\xcb\x38\x7c\x18\xdf\xd9\x38\xa1\x18\xa7\x10\x2b\x6c\xfd\xce\x77\x23\xf2\xef\x76\x9e\xbc\xfc\xfe\x9f\xdf\xcf\xff\x22\xb2\x61\x16\xe7\xcb\x3c\x3d\x07\x82\xf5\x0d\x00\xae\xdd\xf5\xa7\x43\x40\xf0\x3f\x0b\x0f\xdd\x5a\x1d\x04\x44\x06\xf3\x08\x00\x00\xff\xff\x6a\x00\x88\x6d\x04\x18\x00\x00")
- func Ds_storeBytes() ([]byte, error) {
- return bindataRead(
- _Ds_store,
- ".DS_Store",
- )
- }
- func Ds_store() (*asset, error) {
- bytes, err := Ds_storeBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: ".DS_Store", size: 6148, mode: os.FileMode(420), modTime: time.Unix(1530586172, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
- }
- var _build = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x91\x41\x6b\xc3\x30\x0c\x85\xef\xf9\x15\xc6\xa7\xb6\xb4\xf5\xbd\x50\xd8\xff\x28\x21\xc8\x89\xea\x99\xc9\x91\xb1\x95\x8e\xf6\xd7\x8f\x38\x29\x21\x50\xb6\xc1\x76\x32\x7a\x3c\x9e\xbe\x27\x13\x43\xb7\xa9\x94\x52\x4a\xbf\x79\x6e\x2c\x3c\x90\x9a\x34\x10\xe6\xc6\xb1\x31\x31\xb1\xf0\xa9\xc3\xeb\xd1\x3e\x48\xef\x27\xa3\xe3\xa6\xe8\x0d\x79\x9b\x20\xdd\xf5\xbe\xda\x56\x55\x84\xf6\x03\x1c\x6e\x3a\xbc\xc2\x40\xd2\xdc\x7c\xf6\xd6\x93\x97\xbb\x3a\xab\x8b\x36\x66\x11\x4e\x71\xb0\xe4\x5b\x5d\x6f\xab\xea\x07\x00\xf7\x6a\xfb\x6a\xef\x32\x4f\x31\x3d\x04\x54\xe7\xe2\x7b\xa2\x2c\xfe\xd1\x90\x53\x9b\x47\xa4\x32\x94\x48\xc8\x19\x25\x1f\x1d\xcf\x8e\x22\x0a\x86\x48\x20\xb8\xc8\xf5\xf4\xf8\x10\x39\x49\x04\x79\x9f\xd6\x1c\x5a\x0e\x81\x7b\x03\x31\x1a\x61\x26\xf3\x09\xa9\xc3\xde\x38\xec\x31\x81\x70\x32\xcf\xa8\x3c\x07\x09\xb8\x42\xa0\x61\x10\x0e\xd0\x83\xc3\x4e\xcf\xe9\xbf\x39\x5b\xe9\x7d\xf5\x84\x2e\xf1\x10\xd7\xb5\xe7\x6f\x38\x8c\x2d\xd7\x85\x1d\xb1\xdd\x5c\xf4\x6e\xa7\xeb\xed\x1f\x39\x92\xbf\x81\xe0\xf7\x20\x40\xf4\x02\xe2\xa2\x4f\x2b\xc2\xfa\xff\x2e\xf2\x15\x00\x00\xff\xff\xe0\x55\x93\x84\xcb\x02\x00\x00")
- func buildBytes() ([]byte, error) {
- return bindataRead(
- _build,
- "BUILD",
- )
- }
- func build() (*asset, error) {
- bytes, err := buildBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: "BUILD", size: 715, mode: os.FileMode(420), modTime: time.Unix(1534390180, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
- }
- var _assetsGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
- func assetsGoBytes() ([]byte, error) {
- return bindataRead(
- _assetsGo,
- "assets.go",
- )
- }
- func assetsGo() (*asset, error) {
- bytes, err := assetsGoBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: "assets.go", size: 4096, mode: os.FileMode(420), modTime: time.Unix(1535625546, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
- }
- var _clientTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x52\x4b\x6b\xdc\x30\x10\x3e\xaf\x7e\xc5\xd4\xa4\xc5\x0a\x5b\x09\x92\x5b\x20\x97\x24\x97\x1c\x9a\x84\xb6\xd0\x63\x91\xe5\xb1\x22\x62\x4b\x62\x56\x1b\x77\x11\xfa\xef\x45\x7e\x85\xa6\x94\x5e\x8c\x3c\xaf\xef\x31\x23\x25\x3c\x29\xfd\xa2\x0c\x82\xee\x2d\xba\x08\x06\x1d\x92\x8a\x08\xcd\x09\x46\x45\x2d\xba\x9f\x06\x1d\x0b\x7f\x54\x31\x66\x87\xe0\x29\x42\xcd\x00\x00\xaa\x6e\x88\xd5\xf4\x4a\x89\x94\x33\x08\x67\x2f\x78\xda\xc3\xd9\xab\xea\x8f\x08\x57\xd7\x20\xee\xa7\xfa\x43\xce\x55\x4a\x25\x99\xf3\xda\x80\xae\xcd\xf9\x9f\x7d\xb7\x13\xde\x7f\xba\xa7\x77\x68\xa0\x4a\x49\x3c\x35\x8b\xa0\xb5\xa6\x32\xfe\xb3\xf6\xc3\xe0\x9d\x74\x18\x25\x05\x2d\x67\x5d\x7f\xa5\x55\x08\x4b\x4a\x36\xaa\x57\x4e\x23\xc9\x91\x68\xab\xf3\xa6\x47\x61\x7c\xaf\x9c\x11\x9e\x8c\x34\x14\x74\xc5\x38\x63\xda\xbb\xc3\xea\x45\x24\xc4\xfb\x3b\xb8\x86\x8b\x8b\xcb\xcb\x92\x94\x12\x1e\x70\x84\x94\xc4\x83\x1a\x30\x67\x38\x20\xbd\x5a\xbd\x59\xd9\x1d\x9d\x2e\x15\xb5\xf6\xae\x83\xf3\x99\xc0\xa2\xfb\xd6\xbb\xce\x1a\x0e\xe7\xf3\x2f\x24\xb6\x8b\x8a\x0c\xc6\xe2\x4d\x37\x44\xf1\x2d\x90\x75\xb1\xab\xab\xd6\x1e\xb4\x7f\x45\x3a\x5d\x49\xd9\x62\xa7\x8e\x7d\x94\x1f\xdb\x6a\xbf\xf0\xe1\x6c\x37\xea\xd2\xb4\x8c\x7f\xc0\x71\x1e\x39\xa1\xee\xa1\x48\x11\x3f\x6c\x7c\xbe\x59\x84\x17\xae\xf5\x48\x34\x91\xe6\x9c\xed\xb4\x77\x6e\x0f\x48\x34\x4d\xd1\xe2\xce\xaa\xbe\x34\x47\xfc\x15\xc5\xf7\xc7\xbb\xc7\x9a\xef\x61\x26\xc7\xd9\xce\x76\x53\xe9\x87\x6b\x70\xb6\x2f\xb4\x77\x41\x39\xab\x6b\x24\xe2\x6c\x37\x2f\x8c\x30\x1e\xc9\xc1\xa7\x99\x48\x0a\x4d\x61\xb5\xd9\xf4\x46\xcf\xf1\xcc\x32\x9b\x8c\x5c\x6c\x78\xe7\x60\x3c\x05\xdc\x52\x91\x8e\xba\x18\x55\x10\x8a\xaa\x25\x1e\x1a\xf1\x6e\x74\x99\xb9\x9e\x9d\xf8\x82\xf1\xd9\xb7\x87\x9c\x0b\xca\x16\xbd\xf5\xc3\x80\xae\xdc\x5d\x4a\xa2\x7c\xe6\x6b\x9b\x36\x56\xeb\x75\x2b\xfc\x6d\xb7\x75\x39\x40\x45\x6a\xb8\xe9\xbd\x7e\xc9\x99\x43\x89\x7c\x9d\x84\x6e\xa1\x99\xdb\xec\x47\xe5\x7c\x04\x3b\x84\x1e\x0b\x10\xb6\x15\x67\x99\xad\x38\xbf\x03\x00\x00\xff\xff\x3e\xef\xaf\x37\x9d\x03\x00\x00")
- func clientTmplBytes() ([]byte, error) {
- return bindataRead(
- _clientTmpl,
- "client.tmpl",
- )
- }
- func clientTmpl() (*asset, error) {
- bytes, err := clientTmplBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: "client.tmpl", size: 925, mode: os.FileMode(420), modTime: time.Unix(1535625483, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
- }
- var _serverTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x92\xcf\x8a\xdb\x30\x10\xc6\xcf\x99\xa7\x18\xcc\x52\xec\x90\xca\xf7\xc2\x9e\x72\xea\xa1\x61\x49\x1f\x60\x91\x95\x59\xd7\x6c\x2c\x69\x47\x8a\xbd\x46\xe8\xdd\x8b\x24\xc7\x34\x0b\xbd\x24\x66\xbe\xf9\xf3\x9b\x6f\xd4\xb6\xf8\x22\xd5\xbb\xec\x09\x1d\xf1\x44\x8c\x3d\x69\x62\xe9\x09\xbb\x05\x67\xc9\x17\xd2\xaf\x3d\x69\xb0\x0f\x59\x00\xc3\x68\x0d\x7b\xac\x01\x11\x31\x04\x96\xba\x27\x7c\x7a\xa7\xe5\x80\x4f\x93\xbc\xde\x08\x7f\x3c\xa3\xf8\x99\xb3\x5c\x8c\x55\x08\x49\xcc\x1f\xa4\x2f\x31\x42\x2e\x4c\xdd\x06\x45\x58\x85\x20\xce\xa4\xa6\x95\x25\xc6\x2a\xcb\xb6\xcb\xca\x4b\xf7\x25\x5e\xf5\xe6\xbb\x32\xe3\x68\x74\x7b\x1d\x3a\x96\xbc\xb4\x9a\x7c\xcb\x56\xb5\x05\xb9\x82\x06\xa0\x6d\xf1\x44\x33\x86\x20\x4e\x72\xa4\x18\xd7\x75\x90\xad\xba\xaf\xf1\x76\xd3\x2a\x25\xd5\x0a\xf7\x45\x15\xbf\xb3\x72\x34\xfa\x6d\xe8\x0f\xe8\x26\xc6\xfd\x4a\x29\x56\xc8\xd2\xad\xc1\xfa\xb1\xa4\xc1\x00\xbb\xd9\xa5\xbd\xd7\xf8\x89\xe6\x22\xd5\xaa\x81\x9d\xed\xc4\x99\xfa\xc1\x79\xe2\x0d\x69\x95\x67\xb7\xf6\xa8\x9b\x03\x7e\x2b\x6c\xc1\x4d\x1c\x1b\xd8\x31\xf9\x1b\x6b\x9c\x1d\x44\x00\xbf\xd8\xed\x50\xce\xf3\x4d\x79\x0c\xc5\xc8\xff\x72\xa6\xb2\x49\x32\xbe\xa2\xed\xc4\x97\xc1\xf8\xbc\x4d\x8b\x00\xf7\x2b\x8a\x5f\xe4\xff\x98\x8b\x8b\x31\x59\xb8\x45\x8f\x66\x1c\x49\xa7\x63\x86\x20\xd2\x4f\xb9\x63\xb2\xb0\x76\x65\x78\x36\xe1\x3e\xa2\x56\xfe\x13\x95\xd1\x9e\x3e\xbd\x38\x96\xff\x03\x32\x7d\xe0\xfe\x5f\x92\x33\x7d\x24\x2b\x1f\x43\xf6\xba\x1c\x90\x98\x4d\x76\x35\x3f\x05\xa9\x07\x55\x57\xda\x78\x1c\x46\x7b\xa5\x84\x42\x97\xaa\x81\x08\xdb\x8b\xfa\x1b\x00\x00\xff\xff\xb2\x36\x1e\x59\xcd\x02\x00\x00")
- func serverTmplBytes() ([]byte, error) {
- return bindataRead(
- _serverTmpl,
- "server.tmpl",
- )
- }
- func serverTmpl() (*asset, error) {
- bytes, err := serverTmplBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: "server.tmpl", size: 717, mode: os.FileMode(420), modTime: time.Unix(1531821454, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
- }
- var _serviceTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x8f\xcd\x4a\xc4\x40\x10\x84\xef\xf3\x14\xcd\xb0\x07\x17\x24\x8b\x78\x33\xe4\xa4\x08\x7b\x58\x11\xf1\x2e\x43\xb6\x89\x61\x33\x3f\xce\xcc\x06\x43\xd3\xef\x2e\x9d\x5f\x2f\x7b\xab\x29\xbe\xae\xaa\x49\x83\xcb\xe6\x17\x2a\xd0\x21\xfa\xec\x1f\x75\xa9\x54\x30\xf5\xc5\x34\x08\x44\xc5\xfb\x24\x99\x4b\x45\x14\x8d\x6b\x10\x76\x17\x1c\xee\x61\xd7\x9b\xee\x8a\xf0\x54\x41\x71\xb4\xc1\xc7\x9c\x98\x55\x3b\x2a\xd0\x44\x02\x31\xeb\x92\x08\xdd\x99\x59\x29\x1f\x72\xeb\x1d\x34\xfe\x6b\x49\xaf\x40\xf7\x0f\x7a\xcb\x2d\x4e\x98\x92\x69\x50\x82\xec\x24\x65\xc1\x9b\xb1\xc8\x0c\x04\x2b\xf7\xda\x62\x77\x16\x0a\x00\x84\x18\xdf\x9f\x43\x18\xb1\xf9\x39\x5f\x55\xab\x71\x7c\x61\x5e\xd7\xb0\x5a\x54\xc2\xd8\xb7\xf5\x8d\xa2\x13\xe6\x6f\xff\xaf\x69\xb6\x9f\xbd\xb5\xe8\xe4\xc3\x87\x83\x1c\x8e\xb5\x53\x9c\x70\x31\xd4\x5b\xdc\x1d\x51\xf1\x81\x3f\xcc\x7b\x88\x98\xaf\xd1\xa5\xc9\x09\xdd\xc0\xbc\x2f\x61\x5b\xf4\x17\x00\x00\xff\xff\x1d\xec\x9c\x6a\x89\x01\x00\x00")
- func serviceTmplBytes() ([]byte, error) {
- return bindataRead(
- _serviceTmpl,
- "service.tmpl",
- )
- }
- func serviceTmpl() (*asset, error) {
- bytes, err := serviceTmplBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: "service.tmpl", size: 393, mode: os.FileMode(420), modTime: time.Unix(1535599707, 0)}
- a := &asset{bytes: bytes, info: info}
- return a, nil
- }
- var _templateGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x48\x4c\xce\x4e\x4c\x4f\x55\x28\x49\xcd\x2d\xc8\x49\x2c\x49\x2d\xe6\xe2\xd2\xd7\x4f\xcf\xb7\x4a\x4f\xcd\x4b\x2d\x4a\x2c\x49\x55\x48\xcf\xd7\x4d\xca\xcc\x4b\x49\x2c\x49\x54\xd0\x2d\xc8\x4e\x57\x50\xa9\x76\xf7\x0f\x70\x74\xf6\x76\x74\x77\xad\x55\xd0\xcd\x57\x48\x2c\x2e\x4e\x2d\x29\xd6\x4b\xcf\x57\xd0\xe3\x02\x04\x00\x00\xff\xff\x21\xf2\x14\xd7\x4d\x00\x00\x00")
- func templateGoBytes() ([]byte, error) {
- return bindataRead(
- _templateGo,
- "template.go",
- )
- }
- func templateGo() (*asset, error) {
- bytes, err := templateGoBytes()
- if err != nil {
- return nil, err
- }
- info := bindataFileInfo{name: "template.go", size: 77, mode: os.FileMode(420), modTime: time.Unix(1531821454, 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){
- ".DS_Store": Ds_store,
- "BUILD": build,
- "assets.go": assetsGo,
- "client.tmpl": clientTmpl,
- "server.tmpl": serverTmpl,
- "service.tmpl": serviceTmpl,
- "template.go": templateGo,
- }
- // 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{
- ".DS_Store": &bintree{Ds_store, map[string]*bintree{}},
- "BUILD": &bintree{build, map[string]*bintree{}},
- "assets.go": &bintree{assetsGo, map[string]*bintree{}},
- "client.tmpl": &bintree{clientTmpl, map[string]*bintree{}},
- "server.tmpl": &bintree{serverTmpl, map[string]*bintree{}},
- "service.tmpl": &bintree{serviceTmpl, map[string]*bintree{}},
- "template.go": &bintree{templateGo, 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, "/")...)...)
- }
|