gotty/app/resource.go

286 lines
530 KiB
Go
Raw Normal View History

2015-08-16 09:47:23 +00:00
// Code generated by go-bindata.
// sources:
2015-08-23 11:40:18 +00:00
// bindata/static/index.html
// bindata/static/js/gotty.js
// bindata/static/js/hterm.js
2015-08-16 09:47:23 +00:00
// DO NOT EDIT!
package app
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
2015-08-20 07:45:06 +00:00
"os"
2015-08-16 09:47:23 +00:00
"path/filepath"
2015-08-20 07:45:06 +00:00
"strings"
"time"
2015-08-16 09:47:23 +00:00
)
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 {
2015-08-20 07:45:06 +00:00
name string
size int64
mode os.FileMode
2015-08-16 09:47:23 +00:00
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 _staticIndexHtml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x74\x90\xcd\x4e\xc5\x20\x10\x85\xf7\x3e\xc5\x58\xe3\xce\x5c\xea\xf6\x76\xda\xad\x2f\xd0\x8d\x4b\x5a\x48\x99\x86\x16\x02\xe3\x0f\x31\xbe\xbb\x20\xb2\x32\x77\xc5\x19\xe6\x0b\xe7\x0b\x78\xaf\xdc\xca\xc9\x6b\x30\x7c\xd8\xe9\x0e\xeb\x01\x80\x46\x4b\x55\x42\x8e\x4c\x6c\xf5\xf4\xe2\xe6\xf9\x15\x45\x1d\xea\x22\x72\xca\x79\x71\x2a\x3d\xc1\x03\xeb\x70\xd0\x29\x2d\x7c\x79\x17\x89\xc9\x9d\x57\x90\x4b\x74\xf6\x8d\xf5\x00\x46\xd3\x66\xf8\x0a\xcf\x7d\xff\x38\xc0\x07\x29\x36\x6d\x38\x64\xd8\x28\xc3\xbd\xff\x1c\xbe\x51\xd4\x47\x8b\x82\x68\x0e\x58\x2a\xfe\x3a\x15\xbd\x03\xa9\xb1\x6b\x75\xdd\x84\x22\xdf\x35\xa3\x35\x90\x67\x88\x61\x1d\xbb\x8b\xd8\xa3\x30\x85\xbb\xec\xb1\x60\x75\x79\x8b\xdc\x1c\x73\xfa\x47\xa2\xa8\xdd\x59\xe6\xf7\x67\x7e\x02\x00\x00\xff\xff\x2f\x8b\x9a\x58\x31\x01\x00\x00")
2015-08-16 09:47:23 +00:00
func staticIndexHtmlBytes() ([]byte, error) {
2015-08-16 09:47:23 +00:00
return bindataRead(
_staticIndexHtml,
"static/index.html",
2015-08-16 09:47:23 +00:00
)
}
func staticIndexHtml() (*asset, error) {
bytes, err := staticIndexHtmlBytes()
2015-08-16 09:47:23 +00:00
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "static/index.html", size: 305, mode: os.FileMode(436), modTime: time.Unix(1440884946, 0)}
2015-08-23 11:40:18 +00:00
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _staticJsGottyJs = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x94\x56\x5f\x6f\xe2\x38\x10\x7f\xef\xa7\xb0\xf2\x82\x73\x47\x5d\xb8\x93\xee\x01\xc4\x9d\x74\x55\x57\xda\x3f\xda\xae\x0a\xbb\x7d\xa8\xfa\x60\x92\x01\xb2\x18\x1b\xd9\x4e\x23\x76\xc5\x77\xdf\x99\x10\x20\x04\xa7\x6c\xfd\x10\x19\xcf\xcc\x6f\xfe\x78\x7e\x63\xf8\x2c\xd7\x89\xcf\x8c\xe6\x31\xfb\x79\xc5\x70\xbd\x48\xcb\x16\xde\xaf\xdd\x9d\x96\x53\x05\x29\x1b\xb1\x22\xd3\xa9\x29\x84\x32\x89\x24\x55\xb1\xb6\xc6\x9b\xc4\x28\x36\x1a\xb1\xa8\xd4\x1d\x44\xc3\x83\x71\x6e\x51\xc0\xf8\x09\xc6\x7f\xac\x53\x38\x37\xb8\xb9\xe9\xb0\x01\x6d\x69\x17\xb3\x3f\xcf\x90\x17\xc6\xf9\xc0\xf1\x5a\xfa\x85\x96\x2b\x40\x11\x1a\x77\x8e\xbe\xf6\x91\x38\xf4\xf8\x14\xcd\x8d\xf7\x9b\xe8\xf9\x28\x96\xb9\x37\x0f\x90\x18\xad\x21\xf1\xa8\x72\xdd\x1f\x5e\x1d\x84\x66\x0d\xfa\x91\x0c\xcf\x4a\xb0\xd7\x28\x48\xaa\xa1\x60\x8f\x30\x1d\x9b\x64\x09\x9e\x63\x72\xdd\xa3\xd7\xb8\x82\xdb\x1b\x78\xb0\xab\xda\x51\xe1\x84\xd1\xe4\xa6\xee\x04\x5e\x40\xfb\xba\x27\x5a\x0b\xb2\x14\x29\xcc\x64\xae\xfc\xd8\x1b\x2b\xe7\x50\xf9\x56\xd9\x54\x54\x27\xe2\x13\x16\x44\xf1\x78\x78\xd1\x56\x24\x0a\xa4\xe5\xf5\xf8\x68\x91\x66\x05\xbb\xb3\x9a\xe0\x27\xd3\x3b\xcc\x33\x4d\x31\x07\xff\xc5\xc2\xcc\xf1\x58\x38\xcc\x3d\x72\xa0\xd3\x6b\xd0\x89\x49\x33\x3d\x8f\xba\x2c\xb2\xb2\x88\x82\x96\x46\xef\x91\x1f\x40\xa6\x9b\xb6\x22\xd7\x6b\x97\x19\xd4\x2a\x8d\x33\x23\xd6\xb9\x5b\x9c\xc5\x44\x0b\x65\x46\x7f\x9b\x7c\x84\x8d\xf3\xd6\x2c\xa1\x8e\x8c\x27\x21\xf0\xea\x26\x28\x78\x1e\xf5\x22\xec\x21\x52\x1c\x9e\xe9\x6d\xc3\xee\xc8\x6e\xec\x2d\x66\x8c\xbe\x9a\xee\xdb\x22\x3c\x66\xef\xb2\x1f\x27\x41\x62\xdb\xe4\x2b\xed\xba\xcc\x9a\xc2\x5d\x0a\x37\x28\xa4\x15\xf5\x29\x8f\x0f\xe3\xfb\xcf\xc2\x95\xb1\x65\xb3\x4d\xbb\x36\xad\xb0\xa3\xfa\xaa\x22\x1b\xec\x37\xdd\x8b\x16\x94\xc2\xa0\xfc\xbe\xae\xbb\x6d\x95\xc6\x41\xc9\xf9\x69\xe8\x6e\x76\xbd\xa2\x9d\x97\x4a\xe1\x85\x4c\x8d\xb4\x69\x93\x1b\x4d\xbb\x8a\x2a\x09\x92\xc4\x03\x4f\x4d\x92\xaf\x90\x8d\xd4\xe8\x77\x0a\x68\xfb\xff\xe6\x3d\x76\x89\xaf\xae\x2f\x8a\x6b\x78\xdb\x26\xb3\x57\xe0\xdc\x8e\xa7\xaf\x93\x3b\x95\x5e\xa2\x52\x29\x13\xf4\x43\x38\x95\x25\xc0\xfb\x8d\x60\x5d\x91\xf9\x64\xc1\x8f\x7a\x4f\xbd\xe7\x26\x56\x22\x1d\xb0\x4e\xaf\x33\x68\x29\x87\x11\x85\xcd\x3c\x7c\x9d\xbc\xeb\xff\xc3\x09\x23\xd0\xe8\x53\x0b\x72\x39\x0c\xc0\xf6\xdb\x60\x91\xfd\x8f\xe5\x48\x9e\x64\x5e\xc1\x9b\x71\xff\x0a\xe0\xae\x71\xb0\x80\xc5\x61\x02\x34\x64\xcb\x4e\x5e\x4b\xeb\x5a\xc1\xef\xa7\xdf\x71\x86\x8b\x25\x32\x8f\xd7\x6c\x63\x31\x33\xf6\x4e\x62\xd9\x0e\x77\x80\x2a\x6d\xbc\xc2\x97\xc0\x19\x05\xf8\xb0\xcc\x79\x34\x06\xef\x89\xd5\xc4\x24\xb4\xc1\x6f\x34\x28\x7f\xd4\x63\x7b\x42\xc9\x73\x20\x9c\x43\x69\x1a\x33\x12\xd5\xbb\xbf\x63\xbf\x7d\x4b\xfd\xfe\x0e\xd4\xaf\xf9\xb4\x5d\xae\x60\x00\xfe\x48\xcc\x6d\xa3\xb7\x13\x65\xdc\xe5\xce\xce\x66\x8c\x53\x15\x42\xf5\x2e\xab\x93\xeb\x0b\x04\x3d\x68\xd2\xa4\x5d\x98\xe2\xfe\x05\xac\x92\x1b\x1e\xdd\xee\x32\x43\xd7\xec\x96\x62\x49\xf1\xbd\xd1\xb9\x52\x4d\x82\x9f\xd2\xdb\x6e\x0e\x35\xa9\x7b\x6a\x66\x07\xd6\x1a\x7b\x92\x1d\x1d\x34\xb3\x68\x47\xab\x61\xee\xfe\x45\x1c\xde\xaa\xf2\x5f\x40\xcd\xae\xed\xe5\xa3\xca\x9d\x5e\xe1\xbf\x23\xd6\x6b\x46\x80\x1d\x35\xc9\x56\x60\x72\xcf\x77\x7e\xba\x8d\x7b\xff\x83\xf5\x7b\xbd\x5e\x20\xb6\x6d\xcc\xe3\xab\x5f\x01\x00\x00\xff\xff\x42\x24\x4b\x87\xdd\x09\x00\x00")
2015-08-23 11:40:18 +00:00
func staticJsGottyJsBytes() ([]byte, error) {
2015-08-23 11:40:18 +00:00
return bindataRead(
_staticJsGottyJs,
"static/js/gotty.js",
2015-08-23 11:40:18 +00:00
)
}
func staticJsGottyJs() (*asset, error) {
bytes, err := staticJsGottyJsBytes()
2015-08-23 11:40:18 +00:00
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "static/js/gotty.js", size: 2525, mode: os.FileMode(436), modTime: time.Unix(1440884946, 0)}
2015-08-20 07:45:06 +00:00
a := &asset{bytes: bytes, info: info}
2015-08-16 09:47:23 +00:00
return a, nil
}
var _staticJsHtermJs = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xec\x7d\xfb\x7f\xdb\xc6\x91\xf8\xef\xfe\x2b\x10\x35\x57\x92\x36\x45\x91\x7a\xcb\x8e\x92\x63\x2c\x2b\xe7\xfb\x38\x4e\xbe\xb6\x73\xbd\xfb\xd8\xae\x0f\x24\x97\x12\x62\x12\x60\x01\x50\x12\x9b\xe8\xfe\xf6\xef\x3c\xf6\x31\xbb\x00\x48\x3a\x69\x7b\x6d\x2f\x4e\x4c\x93\xc0\x60\x31\x3b\x3b\xef\x9d\xdd\xdd\xdb\x8b\xde\x5c\x27\x45\x34\x4d\x66\x2a\xba\x8d\x8b\xe8\x4a\xa5\x2a\x8f\x4b\x35\x89\x46\xab\x68\x96\x8c\x26\x59\xb9\x37\x4a\xd2\xbd\x71\x96\x8e\xe3\xb2\x57\x5c\xf7\x1e\xc0\x33\xcf\xcb\xe8\x1a\x80\x47\x4a\xa5\xd1\x3c\xce\x3f\x02\x78\xae\xe2\xc9\x6e\x96\xce\x56\xd1\x34\xcb\xa3\x55\xb6\xcc\xa3\x22\x9e\xaa\x72\xd5\x8b\xa2\x57\x71\x79\xad\x72\x7c\xb0\xbc\x8e\xd3\x48\x4d\x92\x32\x82\xff\x27\x49\xae\xc6\xe5\x6c\xd5\x8d\x16\x33\x15\x17\x2a\x9a\x67\x93\x64\xba\x8a\xb2\x54\x45\xd9\x14\x60\x15\x5c\x2b\xa0\xa5\xb1\xc2\x67\x11\xc7\xa2\xd7\x43\x04\xf0\xa7\x46\xee\xc7\x62\x0f\xbe\xf5\x7e\x2c\x2a\xd7\x3e\x8c\xb3\x59\x96\x17\xb5\xb7\xa6\xb5\x57\xe7\xaa\x28\xe2\x2b\xf5\x61\x1e\xa7\xf0\x4f\x5e\x0b\xb3\xc8\xd5\x54\xe5\x2a\x1d\xaf\x07\xcb\x15\x23\x5e\x7b\xb3\x28\xb3\x1c\x9e\x5c\x77\xef\xc3\xf8\x3a\xcf\xe6\xeb\x41\x66\xd9\x38\x9e\xad\x85\x98\xab\x79\x96\xaf\x6a\x41\x4a\x55\x94\x6b\x7b\xb0\x2c\xa7\xa7\xb5\x37\x6e\xc7\xfa\xf2\x75\xa9\xf2\x39\x5e\xa5\x2f\xb5\x17\x3f\x4c\xf3\xd8\xf6\x22\xb8\xf5\x51\xad\x46\x59\x9c\x4f\xd6\xdf\xfd\x00\xdc\x37\x49\xd2\xab\x62\x03\x18\x7c\x99\xc7\x8b\xcd\x40\x8b\xb8\x84\x6b\x69\x3d\x60\xb6\x28\x93\x2c\x6d\x78\xd5\x22\xce\x0b\x4b\xab\xda\x7b\x1f\x92\x89\x4a\xcb\x64\x9a\xa8\xbc\xa9\x8d\x26\xee\x09\xe1\x96\xa3\x62\x39\xaa\xbf\x57\x8c\x73\x90\xbb\xc6\x7b\xd9\x6c\xb6\xc8\xf2\xb2\xfe\x3e\x7e\x24\xa9\xe5\x9a\x86\xbb\x1f\x92\xac\x09\xe0\xae\xfc\x00\x04\xcc\x93\xd1\x12\x18\xa8\x1e\xe8\xa6\xe1\xdd\x37\x25\x30\x75\x9c\xc7\x63\xf8\xf5\xc1\x8e\xd5\x03\x84\x7c\xfd\xdd\x0f\xaf\x9e\x3e\x8b\x2e\x9f\xbf\x78\xf6\xb8\x56\xb0\x9f\x66\x8b\x55\x9e\x5c\x5d\x97\x51\x7b\xdc\x89\xf6\xfb\x83\x7d\xd0\x5b\x2a\x7a\x8a\x42\x92\x2c\xe7\xd1\x77\xaf\xa3\xe1\xb2\xbc\x46\x71\x8f\x86\xb3\x59\x44\xb0\x05\x28\x25\x18\x95\x1b\x35\x21\xa5\xf5\x43\xa1\xd5\x0a\xe8\x3b\x16\xce\x68\x9c\x4d\x54\x04\x3f\xaf\xb2\x1b\xe0\x09\x56\x7a\x71\xf4\xf5\xeb\x8b\xdd\xa2\x5c\x81\x46\x9c\x25\x63\x95\xc2\x63\xa0\xb6\xca\x68\x0c\xaa\x6b\xc4\x9a\x28\x5b\xa6\x93\x28\x49\x51\x45\x45\x2f\x9e\x3f\x7d\xf6\xf2\xf5\x33\x52\x4f\xbd\x07\x0f\x5a\x4b\x54\x5a\x40\xa1\x71\xd9\x7a\xf2\xe0\x41\x32\x8d\xda\xe5\x6a\xa1\xe0\xc5\xd0\x9b\xe8\xb3\xf3\xa8\x05\xcf\xaa\x69\x02\x6f\x6b\x75\x1e\x44\xd0\x44\x9e\xdd\x46\xa9\xba\x8d\x9e\xe5\x79\x96\xb7\x5b\xdf\xcc\xb2\x51\x3c\x8b\x76\x00\x7c\x27\xca\x46\x3f\x82\x8a\x8c\xe2\x19\xaa\xd7\x55\xa4\xee\x92\xa2\x2c\x7a\xad\x0e\xb4\x7c\x13\xe7\xd4\xe4\x79\xf4\xd3\x3d\xfc\xdc\x7b\xf8\xf0\x41\xf4\x30\xfa\x36\x5e\x60\x27\x77\x26\x6a\xa1\xe0\x3d\xe9\x78\xb5\x13\x95\x59\xf4\x76\x87\x7b\xbc\xd3\x8d\x40\x83\xbe\xef\x01\x28\x42\x3f\x8b\xc7\xd7\x91\x03\x45\x52\xc4\xe6\x9d\x29\x08\x6e\x17\xde\xf0\x51\x11\x2e\xbd\x69\x01\x0f\x9b\x66\x10\x12\x3b\xbf\xcc\x67\x44\x1c\x6c\x0c\xda\x81\x56\x26\x05\xe8\x6f\xba\xc7\xed\xe0\xab\xf6\x1e\x60\x03\xf9\x12\x64\x63\xae\x2e\xcc\xeb\x12\x55\x7c\x08\xb0\x7f\x01\xdd\x43\xf4\xa7\xcb\x74\x4c\x92\xc8\x94\x4f\x15\x0c\x0d\xf4\x62\x04\x83\x95\xde\x64\x68\x6e\x26\xcb\x1c\x94\x02\x12\x20\x8f\x73\x40\x3c\x4d\xca\x24\x9e\x25\x7f\x8e\xf1\x31\xaf\x7b\x6a\xa6\xe6\x20\x95\x66\xb8\x10\xf2\x69\x3c\x9b\x8d\xe2\xf1\x47\x78\x7f\x9c\xe7\x31\xf5\x3b\x29\x0b\x35\x9b\x42\xf7\xcb\xdb\x6c\xd7\x3c\x43\x77\x7b\xd4\x94\xbe\xd2\x67\x1a\x15\xc0\x6a\x25\x0d\x33\x20\x31\x51\x20\x76\xc9\x08\xbf\x52\xbf\x6f\xc1\x84\x6a\x03\x46\xaf\x8b\xf2\x6c\x59\xc2\x80\x77\x23\xe0\x8d\xe9\x72\x86\xed\xa1\x91\x9c\xa8\xd1\xf2\xea\x0a\x1e\x03\x13\x69\xda\x1f\x18\xca\x8e\x35\x8e\x96\x16\x8e\x90\x41\x17\xce\xa3\xb7\xef\x1d\x09\x5f\xa9\x71\x96\x4f\x10\x47\x4d\x6f\x31\xbe\x86\x2e\x64\xf2\x99\x9d\x35\x4a\xd1\xed\x35\x98\x72\xb0\xda\xe0\x04\x00\x16\x40\x6b\x75\x07\xba\xaa\xd0\xed\xec\x06\x0d\x45\x3c\xe2\xe3\x6c\xbe\x40\xc7\x01\xef\x42\x1f\xc0\x2b\x80\x76\xd3\x0c\x69\x5d\x22\xa4\x19\xb4\x18\x3a\x31\x9b\xed\x4e\x67\x6a\x72\x05\x17\xcd\xa0\x15
2015-08-16 09:47:23 +00:00
func staticJsHtermJsBytes() ([]byte, error) {
2015-08-16 09:47:23 +00:00
return bindataRead(
_staticJsHtermJs,
"static/js/hterm.js",
2015-08-16 09:47:23 +00:00
)
}
func staticJsHtermJs() (*asset, error) {
bytes, err := staticJsHtermJsBytes()
2015-08-16 09:47:23 +00:00
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "static/js/hterm.js", size: 522491, mode: os.FileMode(292), modTime: time.Unix(1440884946, 0)}
2015-08-20 07:45:06 +00:00
a := &asset{bytes: bytes, info: info}
2015-08-16 09:47:23 +00:00
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)
2015-08-20 07:45:06 +00:00
if err != nil {
2015-08-16 09:47:23 +00:00
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/index.html": staticIndexHtml,
"static/js/gotty.js": staticJsGottyJs,
"static/js/hterm.js": staticJsHtermJs,
2015-08-16 09:47:23 +00: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"}
// 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 {
2015-08-20 07:45:06 +00:00
Func func() (*asset, error)
2015-08-16 09:47:23 +00:00
Children map[string]*bintree
}
2015-08-20 07:45:06 +00:00
2015-08-16 09:47:23 +00:00
var _bintree = &bintree{nil, map[string]*bintree{
"static": &bintree{nil, map[string]*bintree{
2015-08-23 11:40:18 +00:00
"index.html": &bintree{staticIndexHtml, map[string]*bintree{}},
"js": &bintree{nil, map[string]*bintree{
"gotty.js": &bintree{staticJsGottyJs, map[string]*bintree{}},
"hterm.js": &bintree{staticJsHtermJs, map[string]*bintree{}},
}},
2015-08-16 09:47:23 +00:00
}},
}}
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
2015-08-20 07:45:06 +00:00
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
2015-08-16 09:47:23 +00:00
}
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
2015-08-20 07:45:06 +00:00
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
2015-08-16 09:47:23 +00:00
}
func _filePath(dir, name string) string {
2015-08-20 07:45:06 +00:00
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
2015-08-16 09:47:23 +00:00
}