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

Function readTrashInfo

agent/app/service/recycle_bin.go:296–325  ·  view source on GitHub ↗
(srcPath string)

Source from the content-addressed store, hash-verified

294}
295
296func readTrashInfo(srcPath string) (*trashInfo, error) {
297 cfg, err := ini.Load(srcPath)
298 if err != nil {
299 return nil, err
300 }
301 section, err := cfg.GetSection(trashInfoSection)
302 if err != nil {
303 return nil, err
304 }
305 rawPath := section.Key("Path").Value()
306 decodedPath, err := url.PathUnescape(rawPath)
307 if err != nil {
308 decodedPath = rawPath
309 }
310 info := &trashInfo{
311 Path: decodedPath,
312 IsDir: section.Key("IsDir").MustBool(false),
313 }
314 if deletionStr := section.Key("DeletionDate").Value(); deletionStr != "" {
315 if t, parseErr := time.ParseInLocation(trashInfoTimeLayout, deletionStr, time.Local); parseErr == nil {
316 info.DeletionDate = t
317 }
318 }
319 if sizeStr := section.Key("Size").Value(); sizeStr != "" {
320 if sz, sizeErr := strconv.ParseInt(sizeStr, 10, 64); sizeErr == nil {
321 info.Size = sz
322 }
323 }
324 return info, nil
325}
326
327func collectTrashEntries(clashRoot string) []response.RecycleBinDTO {
328 filesDir := trashFilesDir(clashRoot)

Callers 2

buildTrashDTOFunction · 0.85
loadRecycleBinDTOFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected