diskii/data/data.go

286 lines
370 KiB
Go
Raw Normal View History

// Code generated by go-bindata.
// sources:
// data/disks/ProDOS_2_4_1.dsk
// data/boot/prodos-new-boot0.bin
// data/boot/prodos-old-boot0.bin
// DO NOT EDIT!
package data
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 _disksProdos_2_4_1Dsk = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfc\x09\x78\x13\x47\xb6\x37\x8c\x57\x77\xcb\xb6\x64\x6c\xdc\x36\x26\x11\x84\x90\x0a\x5b\x2c\x70\x40\x98\x64\xa2\x21\x09\x18\x07\x1b\xd9\x88\x25\x40\x16\x32\xc9\x4c\x27\x13\x12\x39\xdb\x30\x3b\x4c\x66\x6e\x1c\xe2\xf6\x68\x1c\xb7\x23\xdf\x49\x26\x56\x32\x0a\x1d\x05\x31\x6e\xc5\x2d\x5a\x59\x11\x20\x4b\x40\x60\x24\x0f\x4b\x81\x59\xe4\xc4\x80\x0d\xd8\xc8\x01\xdb\x8d\x6d\x76\x28\xfd\x9f\x92\x0c\x61\xe6\x7f\xef\xfb\x7e\xdf\xf7\xdc\xf7\xc9\xf7\x7e\xef\x2d\xb0\xba\xba\xea\xd4\xa9\xaa\xdf\x39\x75\xea\x9c\xde\x28\x93\xc2\x58\x0a\x3e\xac\x7a\x28\xc2\x68\xab\x0d\x2b\xcb\xca\xca\xca\x74\x21\xbe\x54\x8c\x57\x9a\xf3\xc2\x3e\x33\x9a\xa9\x0c\x97\x18\x01\x68\xbb\x1e\x74\x97\x9a\xa5\x1f\x99\x39\xbe\x90\x37\x8b\x3f\xf5\x99\x1d\x6f\xeb\xc2\xa1\xd3\xe8\xbc\x2b\x75\xcb\xed\xba\xc0\x04\x9d\xa3\x5f\x17\x98\xa2\x73\xbe\x96\xde\xcc\xf6\x4a\x3a\xbe\x54\xaa\x12\x41\xe4\x92\x32\x8d\x37\x57\x72\x95\x65\x95\x96\xca\x85\x95\xf3\xc2\x95\x45\xe1\xca\x12\x29\x83\x7f\x9a\x9f\x0f\x73\x74\x8a\xb5\xeb\xe9\xae\xa7\xbb\x4a\xdc\x25\x91\x54\x7b\x9f\x0c\x32\x32\xa9\x0c\xf4\xb2\xa4\x41\xb4\xbb\x4c\xff\xf2\xf8\x8c\x06\x7b\x66\xd7\x7c\xf7\xfc\x32\x25\x35\x92\xae\x3e\x22\x6a\x2a\xcb\x64\x5a\x67\xc8\x6a\xf0\x95\xb5\xd2\x3a\xf4\x8d\x8d\x3d\x6f\x50\x23\x10\xdd\x2f\xb2\xbe\xb2\x48\x1c\xcd\x08\xfb\xca\xf8\x12\xf2\x33\x4f\x02\x7c\x99\x38\xb6\x72\x7e\xe5\xd3\xe1\xca\x05\xa4\xa7\x5b\x49\x4f\xeb\x16\x76\x2d\x24\x24\x3e\x0b\x3f\x2f\xbb\x0c\x9d\xb2\x00\x68\xb1\xd4\x42\xcb\x9b\xd0\x62\x83\x5b\x55\xf5\x4c\xa7\x18\x89\xa0\xfe\xbe\xaf\xf6\xb6\x88\x1b\xc5\x43\x9f\x78\x3f\xf3\xfa\xc4\x44\xf2\x7d\x21\x6f\x3d\x77\x4a\xf6\x7d\xb1\xbd\x4f\xbd\xd4\xdf\x7d\x2a\x36\x28\x26\xe9\xb7\xf7\xf5\xa8\xe7\x06\x3b\xfb\x1b\xc5\x48\xef\x09\x6f\xa3\xe8\xf3\x6f\xfc\x54\xf6\x7f\xba\xf5\xcc\x19\x71\x3f\x21\x1b\x10\xf7\x77\x0e\x74\xf6\x9f\xef\x3c\xe9\xdd\xdf\x79\xa6\xef\x44\xc7\x60\x77\x5f\xef\x86\xed\x7d\xbd\x5d\xdd\xa7\xce\xf5\x27\xce\xc4\x1d\xfd\xfd\x7d\xfd\xbd\x6b\xc6\xf5\xae\x19\xe7\x7e\x48\xd0\x8c\x97\xc0\x68\x94\xed\x7a\x2d\xa0\x85\x91\x0e\x7b\x8a\xe1\x98\x53\x0b\x9b\xd1\x59\x38\x7a\x92\x6c\x0d\x19\xb0\x60\x0d\xb9\xb2\xc5\xf1\x70\x9f\x41\x19\x2f\x02\x29\x2e\xc4\x83\x0b\xe2\x41\x13\xba\x45\x88\x07\xe5\x78\x10\x0d\x97\xd7\x84\x60\xc5\x44\x25\xd5\x9d\x61\x80\x88\xb1\x7c\x3b\xce\x65\x49\x90\xcb\xf1\xa0\x70\xe9\x9a\x9d\xb1\x1c\x1e\x27\xaf\x09\x79\x3f\xbd\xd2\x9e\x8a\xe6\x4b\xe0\xbf\xd3\xff\x24\xbd\xf6\x7d\x0f\xe0\xbf\xd3\xff\xc2\xa4\xf9\xbe\x07\xf0\xdf\xe9\x7b\x4d\x0c\x48\xf9\xbe\x87\xf0\xdf\xe9\x7b\x4c\xf4\xff\xe9\x16\x80\x02\x4f\x52\x60\xc6\x9d\xec\x88\x09\xe0\x4e\x00\x7f\x3d\xf6\x8e\x6c\x1a\x4c\x9e\x33\x77\xd9\xe2\x25\x8b\xa6\x16\x95\x2e\x4c\xd0\xa4\xfe\x01\xdc\x0e\x5e\xbe\xef\x06\x99\x36\x49\xd6\x5a\x5a\x5a\x3c\xf5\x91\x65\xa5\x96\xa5\x49\x56\x59\x0e\x40\x11\x44\x93\x64\x27\x00\x9c\x71\x67\xf6\x08\x1a\x1c\x5e\x50\xba\xb0\xb4\x68\xce\xd2\xeb\x3d\x66\x65\x51\xff\x11\xd9\xa4\xc5\x4b\x16\xcd\x5d\x74\x83\x0a\xc4\xb5\x60\x1c\x88\x15\xdd\xe8\x14\xcc\xb8\x33\x63\x04\x0d\x46\x2f\x98\x33\xbf\x78\xea\xc2\x45\x53\x17\x9b\x12\x64\x57\x0d\x80\x02\x4f\xdf\x98\x02\xa5\x9d\x71\x27\x43\xb8\x2d\x29\x9e\x33\x77\x41\xf1\x0d\x6e\x9a\xbb\x81\x06\x94\x69\x6e\x74\x0a\x66\xdc\x79\x7b\x2e\x0d\x12\x16\xe0\x6a\xb2\xe7\xa9\x05\x53\xef\x99\x3a\xfd\x26\x68\x08\x2d\x00\xdb\xef\xca\xcc\x00\xa9\x40\x4f\xdd\xf6\x68\x69\xf1\x63\x53\xbf\xe3\x7b\x75\xca\xcd\xd3\xbd\x93\xd2\x4e\xbb\x73\xb4\x8e\x06\xb7\x3d\xfc\x48\xe9\xb2\xa9\x4b\x97\x2f\x5d\x56\xbc\x20\x31\x8f\xc9\x80\x02\x26\xf0\x1d\xc6\xd3\xee\x34\xe8\x68\x30\xba\xa8\x74\xd9\xd2\xe5\x53\x8b\x16\x2d\x5a\x96\x9c\xae\x11\x50\xe0\x65\xea\x66\xb2\xe9\x3a\x1a\xe4\x17\xcd\x59\x5a\xfa\xd0\x77\xec\xe2\x05\x60\x24\x00\x79\xdf\x91\x8d\xbd\xd3\x94\x46\x83\xa9\x0f\x2d\x5a\xbc\xbc\xb4\x74\xb1\xe5\x91\xa5\x53\xef\x9b\x5a\x00\xe2\xf3\xc0\xbd\x00\x3c\x7f\x83\x2c\x77\x9a\x4c\x86\x7a\x4b\x52\xb0\xdf\x61\xfc\xea\xff\x2a\xb5\xfa\xef\xf4\xbf\x47\x9a\xad\x1b\x5a\x77\xf0\x7a\x72\x73\xfc\x5c\xf7\xd3\x7c\xf1\x4b\x66\xa0\x1d\x3b\x61\x76\xf1\xbc\xdf\x0c\x1e\xde\xf7\xc5\xfc\xcf\x1a\xd7\x4f\xd1\x73\x96\x2d\x3a\x69\xad\x59\x8a\x9b\x25\xca\x0
func disksProdos_2_4_1DskBytes() ([]byte, error) {
return bindataRead(
_disksProdos_2_4_1Dsk,
"disks/ProDOS_2_4_1.dsk",
)
}
func disksProdos_2_4_1Dsk() (*asset, error) {
bytes, err := disksProdos_2_4_1DskBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "disks/ProDOS_2_4_1.dsk", size: 143360, mode: os.FileMode(420), modTime: time.Unix(1489201190, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _bootProdosNewBoot0Bin = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xcd\x4f\x68\xd3\x50\x1c\xc0\xf1\x74\xe9\xb6\xfc\x4a\xa7\x1d\x0c\xe9\x41\xd6\x80\xe2\xd6\x55\x10\x04\xa1\x0a\xc5\xa9\x5b\x92\xbe\xc6\xae\x6b\x14\x0a\x82\x24\x17\x0f\x62\x51\x2f\xe2\x6d\x1e\xde\x1b\x55\x18\x54\xf0\xd2\x83\xf0\x28\xbe\xd2\x88\x83\x04\x44\x10\x5a\xe8\x64\x8e\xb4\x8c\xf6\xf9\x0f\x15\x8f\x62\xc0\x09\x5a\x64\x6e\x88\x8a\xd2\xa3\xdf\xf3\x17\x3e\x81\xa4\x23\xea\xfb\xe1\xe6\xf2\x99\xb6\x28\xdd\x89\x5f\x43\x08\x21\x68\x91\x34\xfd\x8b\xb5\x69\xcf\xd5\xf8\x09\x67\x8f\x2d\xae\x08\x92\x9f\x62\x69\xcd\xbe\xa0\x99\x64\x96\x68\xf4\xa2\xab\x55\xee\x81\xd7\xfa\xc2\x77\xaa\x23\x8d\xa3\xd0\x3c\x0e\x95\xef\xd0\x9c\x85\xfb\x4b\xa1\x4e\xe4\xab\x0d\x24\x6d\x2f\x53\xa1\xfd\xd3\x39\x42\x34\x6c\x62\x84\x75\x9c\xc5\xaa\x87\x4f\x7b\x58\xb1\xc3\xc4\x22\x19\x79\x0a\x9c\x4b\xbe\xe5\x5b\xbe\xc2\x94\xf6\x48\xf9\xdb\xaa\x10\x1e\x0b\x84\x79\xde\x0e\xf2\x21\x86\xa2\xc5\x03\xe1\x7a\x79\xcc\xcf\xb0\x0c\x72\x46\xda\xa1\xfe\x75\x1a\xc4\x68\x55\x86\xf8\xde\xba\x8b\xde\xcb\xc0\x3f\x94\x22\x3b\x74\x9f\x8b\x50\x31\x06\x2b\x31\xa0\xe3\x2e\x22\x8a\xe7\x22\xa2\xda\x02\x41\x74\x12\x67\xb0\xe5\xe1\xb3\x03\xe7\xd8\xc0\x79\x90\xf5\xb3\x83\xc5\xd5\x89\x3a\x8e\x78\xb4\x1a\xb0\x85\xfa\x5d\xd3\xe3\xbf\x7c\x6b\x6b\xab\x13\xd9\xee\xc6\xa0\x3f\xca\xdf\x75\x63\xc0\x3b\x05\x5d\x90\x75\x15\x86\x0e\xe5\xf2\x0b\x73\x0b\x06\x33\xc9\x1c\xb3\xc8\xfc\x15\x4d\x90\x26\x0f\x9e\x9c\x57\x6f\x6c\xbf\x7d\xf1\x24\xf3\xf8\x51\x2d\x11\x35\xf5\x06\xc8\x85\xdf\x74\xe2\x69\x01\x2a\xee\x70\x29\xb2\xab\x9f\x87\x37\xdd\xb5\x67\x9b\xcf\xe9\xeb\x1e\xdd\xec\xad\xad\x53\xfe\xb2\xb7\xde\x7b\xc5\x8c\xb8\x38\x33\x9c\x78\xd8\xbc\xd5\xb2\x0f\x57\xc7\x3b\xfc\xcf\xe7\x00\xdf\xad\x25\x4c\xa6\xc4\x47\xdb\xc1\xb8\x28\x85\xa6\x67\x48\x8a\xa9\x88\x29\x97\x11\x22\xa7\x42\x64\x91\xcd\x93\xa9\x5a\xa2\x79\xbb\x25\x37\xc0\x9f\xf2\x53\x7e\xca\x11\xe5\x06\x34\x4a\x2d\x93\xcd\x86\x88\x61\x0b\xe4\x1c\x33\x48\x2e\xf9\x69\xb1\x3f\xe1\x04\x7d\xa3\x3c\xb4\x61\x24\xe5\x22\xb0\x5c\x54\xbe\x0a\xfc\x23\x5d\xc2\x79\x69\x3a\xb9\x91\xef\x77\xa3\x52\xa9\xff\x43\xf8\xaf\x7f\x01\x00\x00\xff\xff\x9b\x44\x2f\x07\x00\x02\x00\x00")
func bootProdosNewBoot0BinBytes() ([]byte, error) {
return bindataRead(
_bootProdosNewBoot0Bin,
"boot/prodos-new-boot0.bin",
)
}
func bootProdosNewBoot0Bin() (*asset, error) {
bytes, err := bootProdosNewBoot0BinBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "boot/prodos-new-boot0.bin", size: 512, mode: os.FileMode(420), modTime: time.Unix(1489973306, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _bootProdosOldBoot0Bin = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x34\xcd\x4f\x68\xd3\x50\x00\xc7\xf1\xb4\xe9\x66\x5e\xe9\xb4\x13\xc1\x1e\x74\x04\x1c\x6e\x59\x05\x41\x2f\x45\x29\x9b\xba\xa6\xe9\x6b\xd6\x75\x8d\x82\xe0\x25\xc5\x8b\x88\x45\x4f\x82\xa7\x79\x78\x6f\x54\x51\xe8\xc1\x4b\x0f\xe2\xb3\xf8\xca\x5e\x70\x92\x80\x08\x42\x0b\x99\xcc\x91\x8c\xb1\x3e\xff\x21\xe2\x51\x8c\x88\xa0\x45\xe6\x86\xa8\x54\x7a\xd8\xf7\xf0\x3b\xfd\xe0\x13\x4a\xd9\xa2\x7e\xec\xe1\xc2\x19\x5f\x94\x6e\x2b\xd7\x20\x84\x10\xb8\x38\x47\x7a\x48\x1b\xf7\x1c\x8d\x9f\xb0\x77\x33\xf1\xae\x20\x05\x69\x9a\xd3\xd8\x05\xcd\xc4\x53\x58\x23\x17\x1d\xad\x7e\x0f\x78\xee\x37\xbe\xd5\x18\x6c\x1d\x04\xed\x51\x50\xff\x09\xda\x49\x70\x7f\x3e\xba\x16\xff\xce\x00\xce\xb1\x05\x22\xf8\xbf\xed\xa3\x58\x43\x26\x82\x48\x47\x05\x94\xf5\xd0\x69\x0f\xa9\x2c\x86\xcb\x38\x2f\xef\x05\xf6\xa5\xa0\x1c\x94\x03\x95\xaa\xfe\x60\xed\xc7\x92\x10\x1b\x0a\xc5\x78\x85\x45\x78\x98\xc2\x44\xe5\x50\x6c\xb1\x36\x14\xe4\x69\x1e\xda\x83\x7e\xb4\x7b\x8e\x44\x10\x5c\x0a\x03\x65\xcf\xa2\x03\x3f\x84\x01\xff\x58\x8d\x6f\x29\x5d\x5f\xe6\x27\x49\xdc\x81\x7e\x8f\x1f\xf7\x1c\x88\xd5\xfe\x64\x99\x80\x21\x19\x41\x79\x54\xf6\xd0\x4c\x5f\xda\xdf\x97\x1e\x15\x82\x42\xff\xe2\xe8\x38\x3b\x0c\xf9\x17\x5d\x90\xf5\x49\x70\xb8\x58\x9a\x9d\x9e\x35\xe4\x9d\xa8\x89\xa7\x69\x19\x67\xae\x68\x82\x34\x32\x3a\x99\xc9\x5e\xdf\x7c\xff\xea\x59\xfe\xe9\xe3\x66\x32\x61\xea\x2d\xc0\x1e\x68\xac\xa7\xb1\x50\x43\xd0\x6f\x6c\xca\xe7\xff\x92\x03\xcf\x8b\xa0\xfe\x64\xa0\x1a\xdf\xd6\x67\x80\x65\x59\xe4\xdd\xc6\xf2\x8b\xf5\x97\xe4\x6d\x87\xac\x77\x96\x57\x08\x7f\xdd\x59\xe9\xbc\x21\x96\x65\x51\x43\x11\x27\x06\x92\x56\xfb\xa6\xcb\x8e\x34\x86\xd7\xf8\xbf\xaf\x21\xbe\xdd\x4c\x9a\x54\x55\x76\xf9\x11\x45\x94\xa2\xe3\x13\x38\x4d\xb3\x90\xaa\x97\x21\xc4\xa7\xa2\x78\x8e\x66\xf0\x58\x33\xd9\xbe\xe5\xca\x2d\x10\x8c\x05\xe9\x20\x6d\x8b\x72\x0b\xb4\xaa\xae\x49\xa7\xa2\xd8\x60\x02\x3e\x4b\x0d\x5c\x4c\x7d\x9e\xeb\xee\xb3\x23\x81\x51\x0b\xaf\x1a\x29\xb9\x02\x68\x31\x21\x5f\x05\xfc\x13\x99\x47\x25\x69\x3c\xb5\x5a\xea\x6e\x24\xa4\x6a\xf7\x57\xfb\x8e\x1b\xff\x23\xec\xf4\x3f\x00\x00\xff\xff\xb3\xd2\x8d\x42\x00\x02\x00\x00")
func bootProdosOldBoot0BinBytes() ([]byte, error) {
return bindataRead(
_bootProdosOldBoot0Bin,
"boot/prodos-old-boot0.bin",
)
}
func bootProdosOldBoot0Bin() (*asset, error) {
bytes, err := bootProdosOldBoot0BinBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "boot/prodos-old-boot0.bin", size: 512, mode: os.FileMode(420), modTime: time.Unix(1489973306, 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){
"disks/ProDOS_2_4_1.dsk": disksProdos_2_4_1Dsk,
"boot/prodos-new-boot0.bin": bootProdosNewBoot0Bin,
"boot/prodos-old-boot0.bin": bootProdosOldBoot0Bin,
}
// 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{
"boot": &bintree{nil, map[string]*bintree{
"prodos-new-boot0.bin": &bintree{bootProdosNewBoot0Bin, map[string]*bintree{}},
"prodos-old-boot0.bin": &bintree{bootProdosOldBoot0Bin, map[string]*bintree{}},
}},
"disks": &bintree{nil, map[string]*bintree{
"ProDOS_2_4_1.dsk": &bintree{disksProdos_2_4_1Dsk, 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, "/")...)...)
}