2020-09-05 07:34:09 +02:00
|
|
|
// Code generated by go-bindata. (@generated) DO NOT EDIT.
|
|
|
|
|
|
|
|
// Package main generated by go-bindata.// sources:
|
2020-07-06 20:40:40 +02:00
|
|
|
// views/includes/_partial.jet
|
|
|
|
// views/includes/blocks.jet
|
|
|
|
// views/index.jet
|
|
|
|
// views/layouts/application.jet
|
2019-06-22 20:34:19 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"compress/gzip"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
2020-09-05 07:34:09 +02:00
|
|
|
"net/http"
|
2019-06-22 20:34:19 +02:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
|
|
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
|
|
|
if err != nil {
|
2020-09-05 07:34:09 +02:00
|
|
|
return nil, fmt.Errorf("read %q: %v", name, err)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var buf bytes.Buffer
|
|
|
|
_, err = io.Copy(&buf, gz)
|
|
|
|
clErr := gz.Close()
|
|
|
|
|
|
|
|
if err != nil {
|
2020-09-05 07:34:09 +02:00
|
|
|
return nil, fmt.Errorf("read %q: %v", name, err)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
if clErr != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf.Bytes(), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type asset struct {
|
|
|
|
bytes []byte
|
2020-07-06 20:40:40 +02:00
|
|
|
info os.FileInfo
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type bindataFileInfo struct {
|
2020-07-06 20:40:40 +02:00
|
|
|
name string
|
|
|
|
size int64
|
|
|
|
mode os.FileMode
|
|
|
|
modTime time.Time
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
// Name return file name
|
2019-06-22 20:34:19 +02:00
|
|
|
func (fi bindataFileInfo) Name() string {
|
|
|
|
return fi.name
|
|
|
|
}
|
2020-09-05 07:34:09 +02:00
|
|
|
|
|
|
|
// Size return file size
|
2019-06-22 20:34:19 +02:00
|
|
|
func (fi bindataFileInfo) Size() int64 {
|
|
|
|
return fi.size
|
|
|
|
}
|
2020-09-05 07:34:09 +02:00
|
|
|
|
|
|
|
// Mode return file mode
|
2019-06-22 20:34:19 +02:00
|
|
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
|
|
|
return fi.mode
|
|
|
|
}
|
2020-09-05 07:34:09 +02:00
|
|
|
|
|
|
|
// ModTime return file modify time
|
2019-06-22 20:34:19 +02:00
|
|
|
func (fi bindataFileInfo) ModTime() time.Time {
|
|
|
|
return fi.modTime
|
|
|
|
}
|
2020-09-05 07:34:09 +02:00
|
|
|
|
|
|
|
// IsDir return file whether a directory
|
2019-06-22 20:34:19 +02:00
|
|
|
func (fi bindataFileInfo) IsDir() bool {
|
2020-09-05 07:34:09 +02:00
|
|
|
return fi.mode&os.ModeDir != 0
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
2020-09-05 07:34:09 +02:00
|
|
|
|
|
|
|
// Sys return file is sys mode
|
2019-06-22 20:34:19 +02:00
|
|
|
func (fi bindataFileInfo) Sys() interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
type assetFile struct {
|
|
|
|
*bytes.Reader
|
|
|
|
name string
|
|
|
|
childInfos []os.FileInfo
|
|
|
|
childInfoOffset int
|
|
|
|
}
|
|
|
|
|
|
|
|
type assetOperator struct{}
|
|
|
|
|
|
|
|
// Open implement http.FileSystem interface
|
|
|
|
func (f *assetOperator) Open(name string) (http.File, error) {
|
|
|
|
var err error
|
|
|
|
if len(name) > 0 && name[0] == '/' {
|
|
|
|
name = name[1:]
|
|
|
|
}
|
|
|
|
content, err := Asset(name)
|
|
|
|
if err == nil {
|
|
|
|
return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil
|
|
|
|
}
|
|
|
|
children, err := AssetDir(name)
|
|
|
|
if err == nil {
|
|
|
|
childInfos := make([]os.FileInfo, 0, len(children))
|
|
|
|
for _, child := range children {
|
|
|
|
childPath := filepath.Join(name, child)
|
|
|
|
info, errInfo := AssetInfo(filepath.Join(name, child))
|
|
|
|
if errInfo == nil {
|
|
|
|
childInfos = append(childInfos, info)
|
|
|
|
} else {
|
|
|
|
childInfos = append(childInfos, newDirFileInfo(childPath))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &assetFile{name: name, childInfos: childInfos}, nil
|
|
|
|
} else {
|
|
|
|
// If the error is not found, return an error that will
|
|
|
|
// result in a 404 error. Otherwise the server returns
|
|
|
|
// a 500 error for files not found.
|
|
|
|
if strings.Contains(err.Error(), "not found") {
|
|
|
|
return nil, os.ErrNotExist
|
|
|
|
}
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
2019-06-22 20:34:19 +02:00
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
// Close no need do anything
|
|
|
|
func (f *assetFile) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Readdir read dir's children file info
|
|
|
|
func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) {
|
|
|
|
if len(f.childInfos) == 0 {
|
|
|
|
return nil, os.ErrNotExist
|
|
|
|
}
|
|
|
|
if count <= 0 {
|
|
|
|
return f.childInfos, nil
|
|
|
|
}
|
|
|
|
if f.childInfoOffset+count > len(f.childInfos) {
|
|
|
|
count = len(f.childInfos) - f.childInfoOffset
|
|
|
|
}
|
|
|
|
offset := f.childInfoOffset
|
|
|
|
f.childInfoOffset += count
|
|
|
|
return f.childInfos[offset : offset+count], nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stat read file info from asset item
|
|
|
|
func (f *assetFile) Stat() (os.FileInfo, error) {
|
|
|
|
if len(f.childInfos) != 0 {
|
|
|
|
return newDirFileInfo(f.name), nil
|
|
|
|
}
|
|
|
|
return AssetInfo(f.name)
|
|
|
|
}
|
|
|
|
|
|
|
|
// newDirFileInfo return default dir file info
|
|
|
|
func newDirFileInfo(name string) os.FileInfo {
|
|
|
|
return &bindataFileInfo{
|
|
|
|
name: name,
|
|
|
|
size: 0,
|
|
|
|
mode: os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir
|
|
|
|
modTime: time.Time{}}
|
|
|
|
}
|
|
|
|
|
|
|
|
// AssetFile return a http.FileSystem instance that data backend by asset
|
|
|
|
func AssetFile() http.FileSystem {
|
|
|
|
return &assetOperator{}
|
|
|
|
}
|
|
|
|
|
|
|
|
var _includes_partialJet = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb2\x29\xb0\xf3\xcc\x4b\xce\x29\x4d\x49\x4d\x51\x28\x48\x2c\x2a\xc9\x4c\xcc\xb1\xd1\x2f\xb0\xe3\xe5\x02\x04\x00\x00\xff\xff\x90\x62\x4f\xfb\x19\x00\x00\x00")
|
|
|
|
|
|
|
|
func includes_partialJetBytes() ([]byte, error) {
|
2019-06-22 20:34:19 +02:00
|
|
|
return bindataRead(
|
2020-09-05 07:34:09 +02:00
|
|
|
_includes_partialJet,
|
|
|
|
"includes/_partial.jet",
|
2019-06-22 20:34:19 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func includes_partialJet() (*asset, error) {
|
|
|
|
bytes, err := includes_partialJetBytes()
|
2019-06-22 20:34:19 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
info := bindataFileInfo{name: "includes/_partial.jet", size: 25, mode: os.FileMode(438), modTime: time.Unix(1599156854, 0)}
|
2019-06-22 20:34:19 +02:00
|
|
|
a := &asset{bytes: bytes, info: info}
|
|
|
|
return a, nil
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
var _includesBlocksJet = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xaa\xae\x4e\xca\xc9\x4f\xce\x56\xc8\x4d\xcd\x2b\xd5\xd0\xac\xad\xe5\xe5\x52\x50\xb0\x29\xb0\x0b\xc9\x48\x05\x0b\x29\x40\x64\xcb\x13\x8b\x15\x32\xf3\xca\xf2\xb3\x53\x53\xf4\x6c\xf4\x0b\xec\x78\xb9\xaa\xab\x53\xf3\x52\x40\xca\x01\x01\x00\x00\xff\xff\xa0\xd9\xd9\x5d\x41\x00\x00\x00")
|
2019-06-22 20:34:19 +02:00
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func includesBlocksJetBytes() ([]byte, error) {
|
2019-06-22 20:34:19 +02:00
|
|
|
return bindataRead(
|
2020-09-05 07:34:09 +02:00
|
|
|
_includesBlocksJet,
|
|
|
|
"includes/blocks.jet",
|
2019-06-22 20:34:19 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func includesBlocksJet() (*asset, error) {
|
|
|
|
bytes, err := includesBlocksJetBytes()
|
2019-06-22 20:34:19 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
info := bindataFileInfo{name: "includes/blocks.jet", size: 65, mode: os.FileMode(438), modTime: time.Unix(1599156854, 0)}
|
2019-06-22 20:34:19 +02:00
|
|
|
a := &asset{bytes: bytes, info: info}
|
|
|
|
return a, nil
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
var _indexJet = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x90\xb1\x6a\xf3\x30\x14\x85\xf7\x1f\xfe\x77\x38\xf5\xd2\x74\xa9\xc9\x5a\x8c\x87\x42\x86\x2e\x5d\xfa\x00\x45\xb6\x6e\xb0\x1a\x59\x57\xf8\x5e\xd7\x36\x22\xef\x5e\x2c\x9b\x10\xda\xed\x48\xe7\x3b\xe8\x43\x29\xd1\xac\x14\xac\xa0\xf0\x66\xe1\x51\xa5\x34\x31\x7a\xd7\x1a\x75\x1c\x9e\xbf\x48\x8b\xeb\xf5\xff\xbf\x94\x5c\x1f\x79\x50\x14\x2e\xb4\x7e\xb4\x24\x65\xe3\xb9\xbd\xc8\x8d\x58\x99\x7c\x05\xcb\xed\xd8\x53\xd0\x57\xb6\xcb\xe1\x69\xed\x80\xaa\x3b\xd6\xa7\xbe\x21\x6b\xc9\x82\x66\xd3\x47\x4f\x55\xd9\x1d\xeb\x75\x08\x54\xc1\x7c\xd7\x6b\x00\x52\x5a\x1c\x79\x8b\x9e\xc2\x78\x5b\x97\x5b\xbf\xe6\x94\x76\x83\x3b\x95\xcf\x68\x06\x75\xc6\xdf\xc9\x64\xf0\x8c\x87\x9d\x79\x3b\x9f\x66\x27\x2a\x87\xc2\x32\xc9\x3b\x6b\x3e\x66\x7e\x7f\x03\xa8\x62\xfd\xd1\xf1\x24\xe8\x78\xfa\x33\xc4\xc4\xc3\x45\x5e\xf0\x7b\x8e\xc9\x08\x02\x2b\x76\xde\xa2\xa1\xd6\x8c\x42\x70\x9a\xe1\xf0\xa8\xa0\x4c\x57\x65\xac\x37\x31\x0a\x76\xfb\xd4\x3d\xfc\x04\x00\x00\xff\xff\x28\x5a\x9d\x42\x85\x01\x00\x00")
|
2020-07-06 20:40:40 +02:00
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func indexJetBytes() ([]byte, error) {
|
2019-06-22 20:34:19 +02:00
|
|
|
return bindataRead(
|
2020-09-05 07:34:09 +02:00
|
|
|
_indexJet,
|
|
|
|
"index.jet",
|
2019-06-22 20:34:19 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func indexJet() (*asset, error) {
|
|
|
|
bytes, err := indexJetBytes()
|
2019-06-22 20:34:19 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
info := bindataFileInfo{name: "index.jet", size: 389, mode: os.FileMode(438), modTime: time.Unix(1599156854, 0)}
|
2019-06-22 20:34:19 +02:00
|
|
|
a := &asset{bytes: bytes, info: info}
|
|
|
|
return a, nil
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
var _layoutsApplicationJet = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x3c\x8e\xbd\xae\xc2\x30\x0c\x85\xf7\x4a\x7d\x07\xdf\x4c\x97\x01\x75\x65\x70\x3b\x00\x65\x85\xa1\x0c\x8c\x69\x6d\x11\x44\x7e\x10\x18\x89\x2a\xca\xbb\x23\xda\xc0\x64\xcb\x3e\xdf\xa7\x83\x7f\xdb\xfd\xa6\x3b\x1d\x5a\x30\xe2\x6c\x53\x16\xf8\x99\x60\xb5\x3f\xd7\x8a\xbd\x6a\xca\x02\x00\x0d\x6b\x9a\x36\x00\x74\x2c\x1a\x06\xa3\xef\x0f\x96\x5a\x1d\xbb\xdd\x72\xa5\xbe\x3f\xb9\x88\xe5\xa6\x75\x3d\x13\x31\x01\xbf\xb4\xbb\x59\xc6\x6a\xbe\x4f\xaa\xea\xe7\xc2\x3e\xd0\x98\xc9\x18\x7b\x1b\x86\x2b\x50\x18\x9e\x8e\xbd\xac\x03\x8d\xff\x8b\x94\x62\x64\x4f\x29\xcd\x64\xce\x63\x95\xab\xbe\x03\x00\x00\xff\xff\xee\xc2\x94\xa4\xbc\x00\x00\x00")
|
2019-06-22 20:34:19 +02:00
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func layoutsApplicationJetBytes() ([]byte, error) {
|
2019-06-22 20:34:19 +02:00
|
|
|
return bindataRead(
|
2020-09-05 07:34:09 +02:00
|
|
|
_layoutsApplicationJet,
|
|
|
|
"layouts/application.jet",
|
2019-06-22 20:34:19 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
func layoutsApplicationJet() (*asset, error) {
|
|
|
|
bytes, err := layoutsApplicationJetBytes()
|
2019-06-22 20:34:19 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-09-05 07:34:09 +02:00
|
|
|
info := bindataFileInfo{name: "layouts/application.jet", size: 188, mode: os.FileMode(438), modTime: time.Unix(1599156854, 0)}
|
2019-06-22 20:34:19 +02:00
|
|
|
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) {
|
2020-09-05 07:34:09 +02:00
|
|
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
|
|
|
if f, ok := _bindata[canonicalName]; ok {
|
2019-06-22 20:34:19 +02:00
|
|
|
a, err := f()
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
|
|
|
}
|
|
|
|
return a.bytes, nil
|
|
|
|
}
|
2020-07-06 20:40:40 +02:00
|
|
|
return nil, fmt.Errorf("Asset %s not found", name)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
2020-07-06 20:40:40 +02:00
|
|
|
// It returns an error if the asset could not be found or
|
|
|
|
// could not be loaded.
|
2019-06-22 20:34:19 +02:00
|
|
|
func AssetInfo(name string) (os.FileInfo, error) {
|
2020-09-05 07:34:09 +02:00
|
|
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
|
|
|
if f, ok := _bindata[canonicalName]; ok {
|
2019-06-22 20:34:19 +02:00
|
|
|
a, err := f()
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
|
|
|
}
|
|
|
|
return a.info, nil
|
|
|
|
}
|
2020-07-06 20:40:40 +02:00
|
|
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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){
|
2020-09-05 07:34:09 +02:00
|
|
|
"includes/_partial.jet": includes_partialJet,
|
|
|
|
"includes/blocks.jet": includesBlocksJet,
|
|
|
|
"index.jet": indexJet,
|
|
|
|
"layouts/application.jet": layoutsApplicationJet,
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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"}
|
2020-09-05 07:34:09 +02:00
|
|
|
// AssetDir("foo.txt") and AssetDir("nonexistent") would return an error
|
2019-06-22 20:34:19 +02:00
|
|
|
// AssetDir("") will return []string{"data"}.
|
|
|
|
func AssetDir(name string) ([]string, error) {
|
|
|
|
node := _bintree
|
|
|
|
if len(name) != 0 {
|
2020-09-05 07:34:09 +02:00
|
|
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
|
|
|
pathList := strings.Split(canonicalName, "/")
|
2019-06-22 20:34:19 +02:00
|
|
|
for _, p := range pathList {
|
|
|
|
node = node.Children[p]
|
|
|
|
if node == nil {
|
2020-07-06 20:40:40 +02:00
|
|
|
return nil, fmt.Errorf("Asset %s not found", name)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if node.Func != nil {
|
2020-07-06 20:40:40 +02:00
|
|
|
return nil, fmt.Errorf("Asset %s not found", name)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
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
|
|
|
|
}
|
2020-07-10 22:21:09 +02:00
|
|
|
|
2020-07-06 20:40:40 +02:00
|
|
|
var _bintree = &bintree{nil, map[string]*bintree{
|
2020-09-05 07:34:09 +02:00
|
|
|
"includes": {nil, map[string]*bintree{
|
|
|
|
"_partial.jet": {includes_partialJet, map[string]*bintree{}},
|
|
|
|
"blocks.jet": {includesBlocksJet, map[string]*bintree{}},
|
|
|
|
}},
|
|
|
|
"index.jet": {indexJet, map[string]*bintree{}},
|
|
|
|
"layouts": {nil, map[string]*bintree{
|
|
|
|
"application.jet": {layoutsApplicationJet, map[string]*bintree{}},
|
2019-06-22 20:34:19 +02:00
|
|
|
}},
|
|
|
|
}}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
2020-07-06 20:40:40 +02:00
|
|
|
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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 {
|
2020-09-05 07:34:09 +02:00
|
|
|
canonicalName := strings.Replace(name, "\\", "/", -1)
|
|
|
|
return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...)
|
2019-06-22 20:34:19 +02:00
|
|
|
}
|