mirror of
https://github.com/AlistGo/alist.git
synced 2025-06-05 09:34:41 +08:00
feat: optimize file operation interface (#2757)
* feat: optimize file operation interface * chore: fix typo Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
@ -40,32 +40,32 @@ func Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, m
|
||||
return res, file, nil
|
||||
}
|
||||
|
||||
func MakeDir(ctx context.Context, path string) error {
|
||||
err := makeDir(ctx, path)
|
||||
func MakeDir(ctx context.Context, path string, lazyCache ...bool) error {
|
||||
err := makeDir(ctx, path, lazyCache...)
|
||||
if err != nil {
|
||||
log.Errorf("failed make dir %s: %+v", path, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func Move(ctx context.Context, srcPath, dstDirPath string) error {
|
||||
err := move(ctx, srcPath, dstDirPath)
|
||||
func Move(ctx context.Context, srcPath, dstDirPath string, lazyCache ...bool) error {
|
||||
err := move(ctx, srcPath, dstDirPath, lazyCache...)
|
||||
if err != nil {
|
||||
log.Errorf("failed move %s to %s: %+v", srcPath, dstDirPath, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func Copy(ctx context.Context, srcObjPath, dstDirPath string) (bool, error) {
|
||||
res, err := _copy(ctx, srcObjPath, dstDirPath)
|
||||
func Copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool) (bool, error) {
|
||||
res, err := _copy(ctx, srcObjPath, dstDirPath, lazyCache...)
|
||||
if err != nil {
|
||||
log.Errorf("failed copy %s to %s: %+v", srcObjPath, dstDirPath, err)
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
func Rename(ctx context.Context, srcPath, dstName string) error {
|
||||
err := rename(ctx, srcPath, dstName)
|
||||
func Rename(ctx context.Context, srcPath, dstName string, lazyCache ...bool) error {
|
||||
err := rename(ctx, srcPath, dstName, lazyCache...)
|
||||
if err != nil {
|
||||
log.Errorf("failed rename %s to %s: %+v", srcPath, dstName, err)
|
||||
}
|
||||
@ -80,8 +80,8 @@ func Remove(ctx context.Context, path string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func PutDirectly(ctx context.Context, dstDirPath string, file *model.FileStream) error {
|
||||
err := putDirectly(ctx, dstDirPath, file)
|
||||
func PutDirectly(ctx context.Context, dstDirPath string, file *model.FileStream, lazyCache ...bool) error {
|
||||
err := putDirectly(ctx, dstDirPath, file, lazyCache...)
|
||||
if err != nil {
|
||||
log.Errorf("failed put %s: %+v", dstDirPath, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user