(isCheck bool, treeType, pathItem string, fileOp fileUtils.FileOp)
| 825 | } |
| 826 | |
| 827 | func loadTreeWithDir(isCheck bool, treeType, pathItem string, fileOp fileUtils.FileOp) []dto.CleanTree { |
| 828 | var lists []dto.CleanTree |
| 829 | files, err := os.ReadDir(pathItem) |
| 830 | if err != nil { |
| 831 | return lists |
| 832 | } |
| 833 | for _, file := range files { |
| 834 | if file.Name() == "ssl" { |
| 835 | continue |
| 836 | } |
| 837 | if file.IsDir() { |
| 838 | size, err := fileOp.GetDirSize(path.Join(pathItem, file.Name())) |
| 839 | if err != nil { |
| 840 | continue |
| 841 | } |
| 842 | item := dto.CleanTree{ |
| 843 | ID: uuid.NewString(), |
| 844 | Label: file.Name(), |
| 845 | Type: treeType, |
| 846 | Size: uint64(size), |
| 847 | Name: strings.TrimPrefix(file.Name(), "/"), |
| 848 | IsCheck: isCheck, |
| 849 | IsRecommend: isCheck, |
| 850 | CanDelete: true, |
| 851 | } |
| 852 | lists = append(lists, item) |
| 853 | } |
| 854 | } |
| 855 | return lists |
| 856 | } |
| 857 | |
| 858 | func loadTreeWithAllFile(isCheck bool, originalPath, treeType, pathItem string, fileOp fileUtils.FileOp) []dto.CleanTree { |
| 859 | var lists []dto.CleanTree |
no test coverage detected