fit: 文件显示大小值问题修复 (#5583)

pull/5588/head
John Bro 5 months ago committed by GitHub
parent 7c7d30376f
commit d00fb2163a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -64,20 +64,6 @@ type FileSearchInfo struct {
fs.FileInfo
}
func getDirSize(fs afero.Fs, path string) (int64, error) {
var size int64
err := afero.Walk(fs, path, func(p string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
size += info.Size()
}
return nil
})
return size, err
}
func NewFileInfo(op FileOption) (*FileInfo, error) {
var appFs = afero.NewOsFs()
@ -115,11 +101,6 @@ func NewFileInfo(op FileOption) (*FileInfo, error) {
}
if op.Expand {
if file.IsDir {
size, err := getDirSize(appFs, op.Path)
if err != nil {
return nil, err
}
file.Size = size
if err := file.listChildren(op); err != nil {
return nil, err
}

Loading…
Cancel
Save