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

Method Clear

agent/app/service/recycle_bin.go:173–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171}
172
173func (r RecycleBinService) Clear() error {
174 partitions, err := disk.Partitions(false)
175 if err != nil {
176 return err
177 }
178 op := files.NewFileOp()
179 for _, p := range partitions {
180 dir := path.Join(p.Mountpoint, recycleBinClashDir)
181 if !op.Stat(dir) {
182 continue
183 }
184 newDir := path.Join(p.Mountpoint, recycleBinClashDir+"-"+strings.ReplaceAll(common.GetUuid(), "-", ""))
185 if err := op.Mv(dir, newDir); err != nil {
186 return err
187 }
188 go func(target string) {
189 defer func() {
190 if r := recover(); r != nil {
191 global.LOG.Warnf("clear recycle bin panic on %s: %v", target, r)
192 }
193 }()
194 _ = op.DeleteDir(target)
195 }(newDir)
196 }
197 return nil
198}
199
200func getClashDir(realPath string) (string, error) {
201 partitions, err := disk.Partitions(false)

Callers

nothing calls this directly

Calls 3

StatMethod · 0.95
MvMethod · 0.95
DeleteDirMethod · 0.95

Tested by

no test coverage detected