EasyDarwin/vendor/github.com/penggy/EasyGoLib/utils/statik-file-system.go

19 lines
313 B
Go
Raw Normal View History

2018-11-07 11:28:13 +00:00
package utils
import (
"net/http"
"strings"
)
type StatikFileSystem struct {
http.FileSystem
}
func (s *StatikFileSystem) Exists(prefix string, filepath string) bool {
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
_, err := s.Open("/" + p)
return err == nil
}
return false
}