fix: 修复文件列表总共条数显示问题 (#952)

pull/954/head
zhengkunwang223 2 years ago committed by GitHub
parent 149c26728c
commit 2b23523bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -113,7 +113,6 @@ func (f *FileInfo) search(search string, count int) (files []FileSearchInfo, tot
scanner := bufio.NewScanner(output) scanner := bufio.NewScanner(output)
for scanner.Scan() { for scanner.Scan() {
line := scanner.Text() line := scanner.Text()
fmt.Println(line)
info, err := os.Stat(line) info, err := os.Stat(line)
if err != nil { if err != nil {
continue continue
@ -159,8 +158,6 @@ func (f *FileInfo) listChildren(dir, showHidden, containSub bool, search string,
} }
} }
f.ItemTotal = 0
var items []*FileInfo var items []*FileInfo
for _, df := range files { for _, df := range files {
if dir && !df.IsDir() { if dir && !df.IsDir() {
@ -222,7 +219,9 @@ func (f *FileInfo) listChildren(dir, showHidden, containSub bool, search string,
} }
items = append(items, file) items = append(items, file)
} }
if containSub {
f.ItemTotal = total f.ItemTotal = total
}
start := (page - 1) * pageSize start := (page - 1) * pageSize
end := pageSize + start end := pageSize + start
var result []*FileInfo var result []*FileInfo

Loading…
Cancel
Save