(_ context.Context, srcObj, dstDir model.Obj)
| 334 | } |
| 335 | |
| 336 | func (d *Local) Copy(_ context.Context, srcObj, dstDir model.Obj) error { |
| 337 | srcPath := srcObj.GetPath() |
| 338 | dstPath := filepath.Join(dstDir.GetPath(), srcObj.GetName()) |
| 339 | if utils.IsSubPath(srcPath, dstPath) { |
| 340 | return fmt.Errorf("the destination folder is a subfolder of the source folder") |
| 341 | } |
| 342 | info, err := os.Lstat(srcPath) |
| 343 | if err != nil { |
| 344 | return err |
| 345 | } |
| 346 | // 复制regular文件会返回errs.NotImplement, 转为复制任务 |
| 347 | if err = d.tryCopy(srcPath, dstPath, info); err != nil { |
| 348 | return err |
| 349 | } |
| 350 | |
| 351 | if d.directoryMap.Has(filepath.Dir(dstPath)) { |
| 352 | d.directoryMap.UpdateDirSize(filepath.Dir(dstPath)) |
| 353 | d.directoryMap.UpdateDirParents(filepath.Dir(dstPath)) |
| 354 | } |
| 355 | |
| 356 | return nil |
| 357 | } |
| 358 | |
| 359 | func (d *Local) Remove(ctx context.Context, obj model.Obj) error { |
| 360 | var err error |
nothing calls this directly
no test coverage detected