ebiten/internal/assets/bindata.go

210 lines
24 KiB
Go
Raw Normal View History

2014-12-10 17:59:38 +01:00
package assets
import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"reflect"
"strings"
"time"
"unsafe"
)
func bindata_read(data, name string) ([]byte, error) {
var empty [0]byte
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
b := empty[:]
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bx.Data = sx.Data
bx.Len = len(data)
bx.Cap = bx.Len
return b, nil
}
type asset struct {
bytes []byte
info os.FileInfo
}
type bindata_file_info struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindata_file_info) Name() string {
return fi.name
}
func (fi bindata_file_info) Size() int64 {
return fi.size
}
func (fi bindata_file_info) Mode() os.FileMode {
return fi.mode
}
func (fi bindata_file_info) ModTime() time.Time {
return fi.modTime
}
func (fi bindata_file_info) IsDir() bool {
return false
}
func (fi bindata_file_info) Sys() interface{} {
return nil
}
var _text_png = "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\xc0\x00\x00\x00\x80\x08\x06\x00\x00\x00\x5d\x84\x66\x6b\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x01\x59\x69\x54\x58\x74\x58\x4d\x4c\x3a\x63\x6f\x6d\x2e\x61\x64\x6f\x62\x65\x2e\x78\x6d\x70\x00\x00\x00\x00\x00\x3c\x78\x3a\x78\x6d\x70\x6d\x65\x74\x61\x20\x78\x6d\x6c\x6e\x73\x3a\x78\x3d\x22\x61\x64\x6f\x62\x65\x3a\x6e\x73\x3a\x6d\x65\x74\x61\x2f\x22\x20\x78\x3a\x78\x6d\x70\x74\x6b\x3d\x22\x58\x4d\x50\x20\x43\x6f\x72\x65\x20\x35\x2e\x34\x2e\x30\x22\x3e\x0a\x20\x20\x20\x3c\x72\x64\x66\x3a\x52\x44\x46\x20\x78\x6d\x6c\x6e\x73\x3a\x72\x64\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x77\x33\x2e\x6f\x72\x67\x2f\x31\x39\x39\x39\x2f\x30\x32\x2f\x32\x32\x2d\x72\x64\x66\x2d\x73\x79\x6e\x74\x61\x78\x2d\x6e\x73\x23\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x3c\x72\x64\x66\x3a\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e\x20\x72\x64\x66\x3a\x61\x62\x6f\x75\x74\x3d\x22\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x78\x6d\x6c\x6e\x73\x3a\x74\x69\x66\x66\x3d\x22\x68\x74\x74\x70\x3a\x2f\x2f\x6e\x73\x2e\x61\x64\x6f\x62\x65\x2e\x63\x6f\x6d\x2f\x74\x69\x66\x66\x2f\x31\x2e\x30\x2f\x22\x3e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3c\x74\x69\x66\x66\x3a\x4f\x72\x69\x65\x6e\x74\x61\x74\x69\x6f\x6e\x3e\x31\x3c\x2f\x74\x69\x66\x66\x3a\x4f\x72\x69\x65\x6e\x74\x61\x74\x69\x6f\x6e\x3e\x0a\x20\x20\x20\x20\x20\x20\x3c\x2f\x72\x64\x66\x3a\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e\x3e\x0a\x20\x20\x20\x3c\x2f\x72\x64\x66\x3a\x52\x44\x46\x3e\x0a\x3c\x2f\x78\x3a\x78\x6d\x70\x6d\x65\x74\x61\x3e\x0a\x4c\xc2\x27\x59\x00\x00\x11\x4b\x49\x44\x41\x54\x78\x01\xed\x9c\xeb\x9a\xdc\x46\x0e\x43\x77\xf3\xe5\xfd\x5f\x79\x37\x98\xce\x99\x20\x30\x29\x95\xd4\xea\xdb\x98\xf5\xc3\x20\x41\xf0\x52\x54\xcb\x63\x7b\x6c\xff\xe7\x3f\x73\x66\x03\xb3\x81\xd9\xc0\x6c\x60\x36\x30\x1b\xf8\x6b\x03\xff\xfb\xeb\x5c\xb1\x88\xae\x4e\xc7\x5f\xd1\xf3\x4c\x8d\x6e\x9e\xa3\x7c\xd7\xbb\xab\xd3\xe9\x9f\xcd\xff\xa1\x86\x1a\xd2\xcf\xde\x10\xd2\x92\x07\xc2\x91\x8b\x2f\xcc\xe3\x39\x1e\x83\xa7\x46\x22\xda\xe4\x2b\x5f\x5a\xe7\xf1\x41\x62\xe9\xc3\x0f\xfe\x1e\x1b\xf8\x7a\x01\x8e\x5c\x55\x1f\x98\xff\xfe\x75\x12\xb7\x6a\x48\xef\x07\x6d\xc5\x11\x4b\xa4\x9f\x72\x64\x67\xbc\xf2\x57\x75\x55\xee\x70\x8f\xdf\x40\x3e\x9f\xf4\xef\x99\x40\xb5\x74\xf6\x6a\xfc\xb9\x27\xc8\x38\x1f\xc0\x44\xe9\xba\x86\xc9\x2b\xb7\xaa\x9b\xdc\x11\x5f\x3d\xb2\xae\xcf\x78\xa4\xd6\x33\xb5\xb9\x1b\x7a\xe7\x5d\xe0\x7f\x0a\x5e\xf9\xbc\xb2\x96\xfb\x6e\x57\xbb\xdb\x7d\x01\xb2\x00\x7e\x87\x34\x51\x1c\x7b\xe5\x61\x52\x8f\x9c\x44\x3e\xcc\xe2\x57\xea\x91\xef\x79\x70\xe0\x5e\x4f\x74\x8f\xc4\x23\x77\x79\xe4\x1c\xcf\xac\xbd\xb5\x77\x9e\xd7\x55\x7b\xd9\xab\xb3\xf9\x02\x68\x50\x2d\xc6\x07\xf6\x01\xe1\xd1\x1d\x5d\x62\x97\x97\x3c\x97\x00\xbd\x8f\x6b\xb1\x53\xc7\xcc\xe4\x75\x3a\xe2\xef\x80\xcc\x98\xb3\xe4\xdd\x32\xfe\xee\xbe\xee\xb5\x77\x07\x9e\x17\x98\x77\xaa\xf8\x95\xba\xaa\x53\xea\x44\xfa\x41\xe8\x9c\x6c\xf8\x0a\xc5\xbd\xf2\x30\xdf\xbd\x33\x3c\xba\xce\x55\xf5\xef\xbd\x27\xf9\xdd\x3c\x47\x79\xea\x25\x56\x75\x2a\xce\xf3\x32\x8e\x0f\xee\x69\xa5\xe3\xa4\x36\xf9\xf6\x2b\x40\xbe\x65\xf2\x55\x0c\x3e\xd1\x1b\x61\xa3\xc1\x07\xcf\xf0\xe4\xae\xa2\x2e\xaa\x3e\xa9\x17\x9f\x5c\x37\x8f\x74\xae\x5f\xa9\xe7\x1a\xcf\xf5\x9e\xce\xbb\xde\x35\x9d\xed\xb9\xae\x39\x5a\xc7\x73\xbb\x9a\x9d\x66\x45\xbf\x35\x8f\x62\xaa\x51\x69\x3a\xde\x67\x91\xed\x33\x60\xab\x9e\x4e\x57\xa3\x8d\x29\xc1\x8f\x37\x13\x5f\xf9\xf0\x20\x9a\x3d\x7f\x4f\x97\xf9\xe8\x8f\xe2\x5e\x9d\xbd\x78\xf6\xeb\xf4\x1d\x9f\xf9\xf8\x47\xf5\xe4\x3d\x0a\xbb\x79\x3a\xbe\x9b\xa3\xd3\x77\xbc\xea\x64\x2c\x7d\x7a\xc1\x83\xc9\xe3\x83\xa9\x83\xaf\xb0\xfd\x0a\x80\x58\x6f\x0d\xb6\xd0\xdf\x22\x35\x72\xdf\x75\x6e\xe7\x40\xd4\x4c\x9e\x9c\xe4\xd1\x13\x1f\xfc\x75\x03\xb9\x33\x14\xef\xbc\xbb\x9c\x2d\x7d\xdd\x41\xf7\xaa\x78\xee\xd7\xe1\x6a\xde\xee\x0b\x90\x0d\x28\x9c\x98\x3a\xf7\xbb\x0b\xc0\x53\x8b\x1c\x78\xfc\x2d\x54\x6e\xc6\x8f\xe4\x67\xee\xa7\xfa\x9f\x72\xe7\xee\x79\x75\xfc\xd6\xf3\xa8\xee\xac\x3a\xf0\xd4\xc4\xaf\x6a\x1d\x7e\x01\x54\x8c\x26\x89\x55\x83\x15\xce\x6b\xae\xe8\x5d\xb3\x75\x39\x16\x80\x7e\x4b\x8b\x
func text_png_bytes() ([]byte, error) {
return bindata_read(
_text_png,
"text.png",
)
}
func text_png() (*asset, error) {
bytes, err := text_png_bytes()
if err != nil {
return nil, err
}
2014-12-10 18:03:13 +01:00
info := bindata_file_info{name: "text.png", size: 4854, mode: os.FileMode(420), modTime: time.Unix(1418230741, 0)}
2014-12-10 17:59:38 +01: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) {
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)
}
// 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){
"text.png": text_png,
}
// 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 name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() (*asset, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"text.png": &_bintree_t{text_png, map[string]*_bintree_t{}},
}}
// Restore 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, path.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
}
// Restore assets under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
return RestoreAsset(dir, name)
} else { // Dir
for _, child := range children {
err = RestoreAssets(dir, path.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, "/")...)...)
}