287fd85918
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
24 lines
430 B
Go
24 lines
430 B
Go
package distribyted
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
type binaryFileSystem struct {
|
|
http.FileSystem
|
|
}
|
|
|
|
func NewBinaryFileSystem() *binaryFileSystem {
|
|
return &binaryFileSystem{Assets}
|
|
}
|
|
|
|
func (fs *binaryFileSystem) Exists(prefix string, filepath string) bool {
|
|
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
|
|
if _, err := fs.Open(p); err != nil {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
return false
|
|
}
|