web/static.go

293 lines
32 KiB
Go
Raw Normal View History

2015-02-09 23:10:53 -08:00
package web
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"strings"
"os"
"time"
"io/ioutil"
"path"
"path/filepath"
)
func bindata_read(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)
gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
return buf.Bytes(), 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 _static_css_sm_css = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x90\x51\xce\xd3\x30\x10\x84\xdf\x73\x0a\x4b\x7d\xe8\x5f\x41\xda\x90\x56\x28\xb8\x42\x54\x42\x1c\xc4\xb5\x9d\x74\x85\xed\x8d\xec\x4d\x69\x41\xbd\x3b\x4e\xe3\x84\x34\x20\xfc\xb8\x33\xeb\xf9\x76\x4e\x60\x5b\xf4\xc4\x3a\x6f\xde\x2e\x44\x2d\xdf\xed\x6a\x74\x14\xb6\x0d\x62\x63\xb4\x68\x21\x6c\x25\xda\x9d\x0c\xe1\x4b\x2d\x2c\x98\xfb\xe7\x6f\x37\x7c\x57\xf2\x4f\x45\xb1\x39\x66\xd9\x19\xd5\x9d\xfd\xca\x58\x7c\x67\x21\xbf\x37\x1e\x3b\xa7\x72\x89\x06\x3d\x67\xab\xb2\x2c\x8f\x4f\x6d\x1c\xd4\x75\x3d\x0c\x48\xdf\x28\x17\x06\x1a\xc7\x99\xd4\x8e\xb4\x1f\xe6\x7d\x78\x3e\x04\x71\xb6\xfe\x8a\x9d\x07\xed\xd7\x83\xd6\x0a\xa5\xc0\x35\x9c\x95\x45\x7b\x3b\x66\x8f\x2c\x13\x29\x7a\xfa\xbe\xaa\x66\xdf\x2b\x2d\xd1\x0b\x02\x8c\x19\x0e\x9d\x7e\xae\xf0\x2b\x04\x20\xad\x16\x9b\xb2\xdf\x8c\xf2\x4a\x46\x80\xc8\x93\xe4\xab\xf6\x04\x52\x98\x11\xd5\x82\x52\x46\x0f\x19\x56\xf8\x06\x5c\x6e\x74\x4d\x9c\x89\x8e\xf0\x65\xec\xa1\xb9\xfc\x6b\x4e\xd8\x8e\x07\x4c\xf7\x06\xf8\xa9\x67\x57\xad\x08\xc8\xe8\x44\xf0\x5a\x48\xec\x9e\x95\xeb\xf7\x2c\x08\x17\xf2\xa0\x3d\xa4\x3a\xff\xc7\x39\x8b\x38\x54\x63\x6e\xea\x32\x3f\x23\x11\xda\xa8\x4c\xe1\xe0\x6a\x4c\xd9\xa3\x69\xc6\x1c\x1d\x27\xab\x15\x08\xf6\x66\xe3\x35\x3f\x40\xd1\xa5\xdf\x8e\xe2\x26\x6d\x2d\x2a\xec\x5f\xb2\xed\xab\xe9\xee\x05\xd8\x87\x09\x2c\x06\x3c\x3f\x99\x77\xb0\x30\x7f\x3c\x2c\xcd\x33\xe6\xbf\xb8\xf7\xc5\x1f\xf7\x23\xfb\x1d\x00\x00\xff\xff\xd8\x97\x08\xca\xf0\x02\x00\x00")
func static_css_sm_css_bytes() ([]byte, error) {
return bindata_read(
_static_css_sm_css,
"static/css/sm.css",
)
}
func static_css_sm_css() (*asset, error) {
bytes, err := static_css_sm_css_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "static/css/sm.css", size: 752, mode: os.FileMode(420), modTime: time.Unix(1423548433, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _static_favicon_ico = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x62\x60\x60\x04\x42\x01\x01\x10\xad\xc0\x90\xc1\xc2\xc0\x20\xc6\xc0\xc0\xa0\x01\xc4\x40\x21\xa0\x08\x44\x1c\x17\xf8\xff\xff\x3f\x43\x88\x9f\xc5\xff\x7f\x0f\xcb\x48\xc2\x20\x3d\x20\xbd\xa3\xfa\x69\xa7\xff\xfc\xee\xca\xff\x87\x36\x55\x81\xd9\xff\xef\x97\xff\xff\x7f\x17\x82\x09\xe9\xff\xff\xa0\xf2\x7f\x49\xcf\xe1\xff\xbf\xff\xfc\x07\x63\x10\x1b\x2c\x4e\x40\x3f\xc8\x0e\x98\x19\xcb\x16\x77\x82\xf5\x81\x70\xdf\xcc\x65\x10\xf9\x87\xa5\x40\x35\x15\x38\xf5\x7f\xbe\x5a\xf2\x1f\x06\x4e\x6c\x2e\xfa\x2f\xaf\xa0\x0c\xc6\x20\x36\x0c\x80\xd4\x20\xeb\xbf\x7e\xf3\xee\x7f\x98\xfe\xe7\x0f\x2f\xfd\xff\xfd\xef\xff\x7f\x41\x61\xf1\xff\x7a\x3a\xea\x70\xb7\x80\xc5\xff\xa0\x8a\x83\xf4\xc0\xf4\x56\x64\x98\xfc\x3f\xb1\xdc\x0f\xac\x0e\x04\xb0\xe9\x47\x16\x07\xa9\x2d\x4d\x35\x07\xeb\x05\x61\x10\x7f\xd5\x24\x0f\xb0\x3b\xbf\x7e\xfb\xfd\xff\xfb\x2f\x88\xfb\x61\xfa\x91\xdd\x0f\x62\x83\xd5\x02\xf5\x20\xbb\xa1\xba\xd8\x0f\x2e\x0e\xc2\xe8\x71\x79\xe6\xe0\xb4\xff\xa7\xf6\xf7\xff\x5f\x3a\x29\x04\xac\x16\xa6\x17\x16\x86\x0f\x1f\x3d\xfd\xbf\x60\x4e\x0f\x58\x0e\x84\xc3\xfd\x0c\xff\x3b\x5a\xa9\xfe\xf7\x73\x55\xff\x9f\x1a\xae\x0b\x17\x07\xa9\x01\xa9\x85\xe9\xc3\x85\x5f\xbd\xfe\xf8\xff\xce\xfd\xc7\x60\x3b\x40\x6c\x5c\xea\x28\x05\x80\x00\x00\x00\xff\xff\x9f\x48\x88\x13\x7e\x04\x00\x00")
func static_favicon_ico_bytes() ([]byte, error) {
return bindata_read(
_static_favicon_ico,
"static/favicon.ico",
)
}
func static_favicon_ico() (*asset, error) {
bytes, err := static_favicon_ico_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "static/favicon.ico", size: 1150, mode: os.FileMode(420), modTime: time.Unix(1423544989, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _static_img_smcquay_png = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x00\x87\x13\x78\xec\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x50\x00\x00\x00\x50\x08\x06\x00\x00\x00\x8e\x11\xf2\xad\x00\x00\x00\x06\x62\x4b\x47\x44\x00\xfa\x00\xfa\x00\xfa\x1e\xfc\x1e\x87\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdf\x02\x0a\x05\x0d\x2a\x52\x1f\xc2\x2e\x00\x00\x13\x14\x49\x44\x41\x54\x78\xda\xed\x9b\xeb\x93\x55\xd5\x99\xc6\x7f\x6b\xed\xfb\x39\xdd\xf4\x8d\x3b\x2d\x88\xc0\xa8\x88\x77\x0c\x06\x34\xc6\xfb\x04\x31\x26\x15\x75\xca\x64\x9c\xd4\x54\xa5\x92\xf9\x33\x92\xff\x60\x6a\xbe\x65\x32\x35\x49\x39\x26\x93\x49\x70\x32\x63\x89\x49\x50\x93\xa0\x21\x21\x8a\xa8\x20\x46\x89\x42\x83\x34\xd7\xbe\xd1\x87\x73\xd9\x97\xb5\xde\xf9\xb0\xf6\x39\xdd\x20\x12\x71\x34\x6d\xa4\xdf\xaa\xee\xd3\xbd\xcf\xee\x7d\xd6\x7e\xf6\x7b\x79\xde\x67\xbd\x0d\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\xb3\x36\x6b\x17\x60\xea\x93\xb4\x18\xcf\xf3\x48\x92\x84\x38\x8e\x7f\x12\x86\xe1\x43\x41\x10\x00\x90\x65\x19\x79\x9e\xff\xb4\xd5\x6a\x3d\xdc\x6c\x36\x31\xc6\xcc\x02\xb8\x7c\xf9\x72\x59\xbd\xfa\x4a\x7a\xaa\x31\xa1\x27\x28\x9b\xa3\xb1\xe4\xad\x06\xcd\x46\x9d\x22\xcf\x28\x8a\x1c\x00\x3f\x08\x08\xfc\x90\xa4\x5a\x25\x88\x2a\x88\xf2\xb0\xca\xa7\x55\x08\x93\x8d\x8c\x3d\x7b\x5e\xe7\xd0\xa1\x43\xea\x53\x0f\xe0\xfc\xf9\xf3\xc7\xbe\x70\xcf\x5d\x7d\x5d\x21\x8c\x1e\x1d\xe2\xcd\xd7\x5f\x25\xcf\x52\x50\x67\x2e\x44\x9d\xb5\x42\x25\xef\xbf\xd2\x28\x8e\xb9\x72\xcd\xf5\xf4\x2e\x5c\xc6\xa9\xa6\xe5\xe9\x5f\x3e\xfb\xf2\xc9\x93\x27\xd7\x7e\xaa\x00\x8c\xa2\x88\xaf\x3d\xf2\x77\x12\xda\x3a\x47\x0e\xee\x67\xd1\xe2\x25\x88\x18\x14\x20\xc0\xee\x97\x77\x70\xba\x36\x39\xed\x2f\x04\x55\xa2\xaa\xdc\xaf\xc8\x59\x20\x77\x77\xf7\xb0\xe6\x86\xcf\x00\x0a\xad\x15\x5a\x6b\x8e\x1f\x1d\x66\xc9\xb2\x15\x9c\xb6\x09\xff\xf1\xa3\xff\x52\x59\x96\xfd\xf5\x03\xb8\x74\xe9\x52\xf9\xea\x43\x5f\xe2\xd7\x4f\x3f\xc1\x35\xd7\xdd\xc0\xbb\x43\xef\x70\xf0\x9d\xb7\xd0\x0a\xe2\x38\x24\xf0\x7d\xae\xb9\xf1\xb3\xfc\xe9\xad\x37\x38\x79\xec\x88\x5b\xd4\xb4\x55\xb9\x9f\xdb\x50\xbb\x37\xe6\x2d\x58\xcc\xe2\x4b\x57\xf1\xea\x8b\xbf\x25\x0e\x03\x7c\xdf\x03\x11\x96\x2c\xbb\x8c\x45\x83\xcb\x78\x63\xf7\x2e\x36\xdc\xf3\x15\x7e\xf0\xe3\x9f\x7d\xec\xa1\xfd\xb1\x5e\xfc\x8a\x2b\xae\x90\x7b\x6e\xdf\xc0\xf6\x5f\xfd\x9c\xeb\xae\x5f\xcb\xef\xb6\x3d\x43\x91\x67\x68\xe5\x80\xa9\xc4\x11\x41\xe0\xa3\x15\x5c\xb3\x76\x3d\x2f\xfd\xee\x79\xb2\x2c\x9d\x5a\xd4\x34\xaf\x6b\xc3\x97\x54\xaa\xac\xb8\xfa\x66\x5e\xde\xfe\x1c\xd5\x24\x22\xf0\xfd\xce\x79\x4a\x81\xef\xfb\xdc\x70\xf3\xe7\xd8\xf3\xca\x4b\xac\xfb\xfc\x17\xf8\x9f\x5f\xfe\x96\x3f\xbe\xf9\xa6\xfa\xab\x03\xf0\xaa\xab\xae\x92\x5b\x6e\x5e\xcb\x9b\x7b\x5e\x66\xde\x40\x3f\xbb\x5e\xdc\x8e\x42\x10\x71\x60\x00\xf8\x5a\x51\x89\x43\xe2\x28\xc0\xf7\x34\xab\xae\xba\x9e\x9d\xbf\x7f\x1e\xd5\x81\x6b\x2a\x94\x01\x82\x20\xe0\xaa\xb5\x9f\xe3\xf9\x6d\xbf\xa1\x2b\x82\x24\x8a\x3a\xd7\x6a\x03\xa8\xb5\x42\x03\xab\xaf\xbb\x89\xd1\x91\x13\xfc\xcd\x9a\x1b\xf9\xdf\x67\x77\xf0\xe6\xc7\x04\xa2\xf7\x71\x5c\x74\xdd\xba\x75\x72\xe3\x35\x57\x32\x72\xec\x08\x45\x7a\x9a\xbd\xbb\x77\x01\x60\x04\x0a\x0b\xb9\x11\x32\xe3\x5e\x0b\x63\x08\x3c\x85\xa7\x35\x71\x1c\x63\x8c\xa5\xd9\x6c\x4c\x81\x52\xfe\x14\x84\x01\xf3\x17\x2e\xe1\xd0\xc9\x3a\x79\x6d\x84\x4a\x1c\x01\x90\x66\x39\xad\x34\x23\xcd\x72\x8c\xb5\x28\xa5\x50\x5a\x33\x72\xfc\x08\x7d\xfd\xf3\x30\x45\xc6\x0d\x57\x5f\x49\xae\xa2\x6f\x0f\x0f\x0f\x7f\xe7\xa3\xbe\x57\xff\xa3\xbe\xe0\x5d\x77\xde\x29\x57\xad\x5a\x4a\x6d\x72\x82\x03\x6f\xbd\xc6\xa9\x89\x71\x44\xc0\xd8\x36\x80\x42\x56\x40\x5a\x08\x46\x20\xf1\x05\x48\x19\xe8\xf1\x38\x7c\x70\x3f\x2b\xae\xb8\x9a\x89\xb1\x91\xf7\xc4\x88\xe7\xf9\xc4\x7d\x8b\x39\xfc\xfb\xed\x0c\x74\x05\x80\xa2\xd9\x6c\x51\x58\xe7\xd5\x56\x84\x3c\x2d\x48\x33\x43\x1c\xf9\x24\x51\xc0\xbb\x43\x6f\xd3\xd5\x3d\x87\x39\x73\x7a\xb9\xeb\xe6\x35\x74\x77\x77\xc9\x73\xcf\xfd\x4a\x7d\x62\x3d\xf0\xce\x3b\xef\x94\x4d\xf7\xde\xce\x1b\xaf\xed\x64\xc7\xb6\x67\x69\xb5\x9a\x14\x96\xce\x97\xb5\x0e\xb4\xc2\x40\xb3\x70\xc7\x52\x03\xb9\x15\x22\x2d\
func static_img_smcquay_png_bytes() ([]byte, error) {
return bindata_read(
_static_img_smcquay_png,
"static/img/smcquay.png",
)
}
func static_img_smcquay_png() (*asset, error) {
bytes, err := static_img_smcquay_png_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "static/img/smcquay.png", size: 4999, mode: os.FileMode(420), modTime: time.Unix(1423545222, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _static_index_html = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x54\x5b\x4f\xdb\x30\x14\x7e\xdf\xaf\xf0\xf2\x92\x64\x72\x9d\x75\x42\xbb\x35\x41\x82\x81\xa6\x3d\x00\x9b\xc6\x1e\xa6\xaa\x0f\xc6\x39\x75\x0c\x89\x1d\xec\x53\xb2\x88\xf2\xdf\xe7\x5c\x80\xd2\xee\xa2\xad\x0f\xcd\xb9\xe5\x9c\xef\xfb\x4e\xec\xf4\xf9\xd1\xd9\x87\xf3\xef\x9f\x8f\x49\x81\x55\xb9\xff\x2c\x1d\x1e\xc4\xff\xd2\x02\x78\x3e\x98\xbd\x5b\x01\x72\x22\x8c\x46\xd0\x98\x05\x8d\xca\xb1\xc8\x72\xb8\x51\x02\x26\xbd\x43\x89\xd2\x0a\x15\x2f\x27\x4e\xf0\x12\xb2\x69\x40\x34\xaf\x20\x0b\x6e\x14\x34\xb5\xb1\x18\x6c\x34\x43\x85\x25\xec\xbb\x4a\x5c\xaf\x78\x9b\x26\x83\xfb\x98\x2e\x95\xbe\x22\x16\xca\x2c\x70\xd8\x96\xe0\x0a\x00\x0c\x08\xb6\xb5\x6f\x87\xf0\x03\x13\xe1\x5c\x40\x0a\x0b\xcb\x2c\xe8\xec\xc4\x55\xac\x0b\x8d\xc8\x93\x47\xe8\xe9\x85\xc9\xdb\x8d\xce\xb9\xba\x21\x2a\xcf\x82\x91\xc8\x06\xa6\x27\xe9\x1e\xd0\x56\xb2\x2f\xe0\xe3\xd4\x02\xb1\x76\xef\x93\xc4\x81\x60\x03\x0b\x56\xf9\x17\x1e\x18\xf1\xad\xc6\x89\xef\xfc\x9b\x59\xb5\x12\xff\x31\x29\x55\x95\x24\xce\x0a\x2f\x80\xb7\x92\x71\x30\xab\xb5\xf4\xb9\x7f\x19\xaf\xf4\xd2\xfc\x6a\x7e\xbd\x1b\x3b\x69\xfb\x95\x12\xe5\x9e\xc2\xeb\xd0\x21\xd4\x05\xe8\x4d\x84\x5f\x87\x10\x39\x11\x5f\x46\x49\x28\xf9\x3b\x4d\x6c\x14\x22\x58\x26\x4c\x75\x4f\xea\x89\xac\xc4\x68\x82\x85\xc7\xe0\xf7\x67\x35\x20\xdb\x69\xf9\x89\xb8\x1a\xf8\xd5\x6e\x6b\x69\x4a\xae\x25\x33\xd6\x4b\x24\x8d\xc7\x66\x77\x84\x1a\xc4\xaa\xff\xa8\xde\xb6\xeb\x84\x55\x35\xee\x93\x68\xb9\xd2\x02\x95\xd1\x91\xa2\x8e\x1a\x2a\xa9\xa5\x9c\x56\xf1\xad\x9a\x87\x1f\x8d\x91\x25\x1c\x68\x5e\xb6\xa8\x84\x3b\xbb\xb8\x04\x81\xe1\x22\xb3\x33\x35\xb7\x8b\xac\xfb\x5b\xaf\x1f\xde\x8f\x6f\x49\xd4\x85\xd8\x75\x36\x3c\xd6\xeb\xf9\x22\x66\xf5\xca\x15\x11\xb7\x72\x55\xf9\x2f\xd7\xc5\x77\xb4\x4f\x96\xd9\xf4\x85\x86\x86\x1c\x71\x84\x28\x9e\xf1\xcc\x31\x61\xc1\x3b\xc7\x25\x74\x85\x91\x89\x29\xa9\x7c\x54\x02\x8e\x21\x77\xd8\x9e\x73\x79\xea\x57\xe9\x93\xf3\x97\x8b\x19\x67\xdc\xb5\x5a\x64\x53\x6f\x75\xdf\x94\x9c\x55\xac\xe6\xd6\x97\x9e\x9a\x1c\x98\xd2\x0e\x2c\x1e\xc2\xd2\x58\x88\x3a\x4a\xe4\x2e\x8e\x1a\xa5\x73\xd3\xd0\xdc\x88\x1e\x0f\x0d\x07\x1d\x42\x1a\x26\x49\xd3\x34\x4c\xf6\x94\x27\xfc\x9e\x73\xbf\xd1\x47\xef\xd2\xf9\x4a\xc9\xc3\x78\x46\x24\x8f\xc2\x01\x72\x48\x49\xf8\xed\x60\xf2\xea\xed\xeb\x77\xd3\xbd\x37\x93\xbd\xce\xe7\x2b\x34\xf7\x55\x0e\x74\xde\xc5\x6a\x2e\xa1\xbb\x56\xba\x78\x9a\x8c\x0b\x18\xcf\xfe\x70\xe0\xfd\x1d\xd0\xdf\x64\x3f\x03\x00\x00\xff\xff\x60\xa5\x9a\x15\xe1\x04\x00\x00")
func static_index_html_bytes() ([]byte, error) {
return bindata_read(
_static_index_html,
"static/index.html",
)
}
func static_index_html() (*asset, error) {
bytes, err := static_index_html_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "static/index.html", size: 1249, mode: os.FileMode(420), modTime: time.Unix(1423548212, 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)
}
// 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/sm.css": static_css_sm_css,
"static/favicon.ico": static_favicon_ico,
"static/img/smcquay.png": static_img_smcquay_png,
"static/index.html": static_index_html,
}
// 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{
"static": &_bintree_t{nil, map[string]*_bintree_t{
"css": &_bintree_t{nil, map[string]*_bintree_t{
"sm.css": &_bintree_t{static_css_sm_css, map[string]*_bintree_t{
}},
}},
"favicon.ico": &_bintree_t{static_favicon_ico, map[string]*_bintree_t{
}},
"img": &_bintree_t{nil, map[string]*_bintree_t{
"smcquay.png": &_bintree_t{static_img_smcquay_png, map[string]*_bintree_t{
}},
}},
"index.html": &_bintree_t{static_index_html, 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, "/")...)...)
}