MCPcopy Index your code
hub / github.com/bytesizedhosting/bcd / AssetDir

Function AssetDir

plugins/plugin_data.go:995–1015  ·  view source on GitHub ↗

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") wou

(name string)

Source from the content-addressed store, hash-verified

993// AssetDir("foo.txt") and AssetDir("notexist") would return an error
994// AssetDir("") will return []string{"data"}.
995func AssetDir(name string) ([]string, error) {
996 node := _bintree
997 if len(name) != 0 {
998 cannonicalName := strings.Replace(name, "\\", "/", -1)
999 pathList := strings.Split(cannonicalName, "/")
1000 for _, p := range pathList {
1001 node = node.Children[p]
1002 if node == nil {
1003 return nil, fmt.Errorf("Asset %s not found", name)
1004 }
1005 }
1006 }
1007 if node.Func != nil {
1008 return nil, fmt.Errorf("Asset %s not found", name)
1009 }
1010 rv := make([]string, 0, len(node.Children))
1011 for childName := range node.Children {
1012 rv = append(rv, childName)
1013 }
1014 return rv, nil
1015}
1016
1017type bintree struct {
1018 Func func() (*asset, error)

Callers 1

RestoreAssetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected