listing files uses limits
parent
36a458406f
commit
fc08058f29
8
files.go
8
files.go
|
|
@ -36,6 +36,7 @@ func NewFiles(root string) (*Files, error) {
|
||||||
|
|
||||||
func (b *Files) List(ns []string, limits ...string) ([]string, error) {
|
func (b *Files) List(ns []string, limits ...string) ([]string, error) {
|
||||||
namespace := resolve.Namespace(ns)
|
namespace := resolve.Namespace(ns)
|
||||||
|
limits = resolve.Limits(limits)
|
||||||
files := make([]string, 0)
|
files := make([]string, 0)
|
||||||
err := filepath.Walk(b.root, func(p string, info os.FileInfo, err error) error {
|
err := filepath.Walk(b.root, func(p string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -50,13 +51,14 @@ func (b *Files) List(ns []string, limits ...string) ([]string, error) {
|
||||||
filedir := path.Join(b.root, namespace)
|
filedir := path.Join(b.root, namespace)
|
||||||
file := strings.TrimPrefix(p, filedir+"/")
|
file := strings.TrimPrefix(p, filedir+"/")
|
||||||
file = strings.TrimSuffix(file, fileExt)
|
file = strings.TrimSuffix(file, fileExt)
|
||||||
files = append(files, file)
|
if file >= limits[0] && file <= limits[1] {
|
||||||
|
files = append(files, file)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return files, err
|
return files, err
|
||||||
/*
|
/*
|
||||||
limits = resolve.Limits(limits)
|
*/
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Files) Get(key string, ns ...string) ([]byte, error) {
|
func (b *Files) Get(key string, ns ...string) ([]byte, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue