(srcPath string)
| 294 | } |
| 295 | |
| 296 | func 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 | |
| 327 | func collectTrashEntries(clashRoot string) []response.RecycleBinDTO { |
| 328 | filesDir := trashFilesDir(clashRoot) |
no outgoing calls
no test coverage detected