|
@ -23,15 +23,15 @@ func splitPattern(pattern string) (prefix string, restPattern string) { |
|
|
// For now, prefix and namePattern are mutually exclusive
|
|
|
// For now, prefix and namePattern are mutually exclusive
|
|
|
func (f *Filer) ListDirectoryEntries(ctx context.Context, p util.FullPath, startFileName string, inclusive bool, limit int64, prefix string, namePattern string, namePatternExclude string) (entries []*Entry, hasMore bool, err error) { |
|
|
func (f *Filer) ListDirectoryEntries(ctx context.Context, p util.FullPath, startFileName string, inclusive bool, limit int64, prefix string, namePattern string, namePatternExclude string) (entries []*Entry, hasMore bool, err error) { |
|
|
|
|
|
|
|
|
|
|
|
if limit > math.MaxInt32-1 { |
|
|
|
|
|
limit = math.MaxInt32 - 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
_, err = f.StreamListDirectoryEntries(ctx, p, startFileName, inclusive, limit+1, prefix, namePattern, namePatternExclude, func(entry *Entry) bool { |
|
|
_, err = f.StreamListDirectoryEntries(ctx, p, startFileName, inclusive, limit+1, prefix, namePattern, namePatternExclude, func(entry *Entry) bool { |
|
|
entries = append(entries, entry) |
|
|
entries = append(entries, entry) |
|
|
return true |
|
|
return true |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
if limit == math.MaxInt64 { |
|
|
|
|
|
limit = math.MaxInt64 - 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hasMore = int64(len(entries)) >= limit+1 |
|
|
hasMore = int64(len(entries)) >= limit+1 |
|
|
if hasMore { |
|
|
if hasMore { |
|
|
entries = entries[:limit] |
|
|
entries = entries[:limit] |
|
|