mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
remove binaryFilesystem wrapper from bindata files (#964)
This commit is contained in:
parent
52a932bc6b
commit
f74216761a
@ -4,37 +4,16 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type binaryFileSystem struct {
|
func newBinaryFileSystem(root string) *assetfs.AssetFS {
|
||||||
fs *assetfs.AssetFS
|
return &assetfs.AssetFS{
|
||||||
}
|
|
||||||
|
|
||||||
func (b *binaryFileSystem) Open(name string) (http.File, error) {
|
|
||||||
return b.fs.Open(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *binaryFileSystem) Exists(prefix string, filepath string) bool {
|
|
||||||
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
|
|
||||||
if _, err := b.fs.Open(p); err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func newBinaryFileSystem(root string) *binaryFileSystem {
|
|
||||||
return &binaryFileSystem{
|
|
||||||
fs: &assetfs.AssetFS{
|
|
||||||
Asset: Asset,
|
Asset: Asset,
|
||||||
AssetDir: AssetDir,
|
AssetDir: AssetDir,
|
||||||
AssetInfo: AssetInfo,
|
AssetInfo: AssetInfo,
|
||||||
Prefix: root,
|
Prefix: root,
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user