MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / loadTreeWithDir

Function loadTreeWithDir

agent/app/service/device_clean.go:827–856  ·  view source on GitHub ↗
(isCheck bool, treeType, pathItem string, fileOp fileUtils.FileOp)

Source from the content-addressed store, hash-verified

825}
826
827func 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
858func loadTreeWithAllFile(isCheck bool, originalPath, treeType, pathItem string, fileOp fileUtils.FileOp) []dto.CleanTree {
859 var lists []dto.CleanTree

Callers 3

ScanMethod · 0.85
loadUpgradeTreeFunction · 0.85
loadLogTreeFunction · 0.85

Calls 4

ReadDirMethod · 0.80
IsDirMethod · 0.80
GetDirSizeMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected