style: shorten name operations
to op
This commit is contained in:
@ -5,54 +5,54 @@ import (
|
||||
|
||||
"github.com/alist-org/alist/v3/internal/errs"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/operations"
|
||||
"github.com/alist-org/alist/v3/internal/op"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func makeDir(ctx context.Context, path string) error {
|
||||
storage, actualPath, err := operations.GetStorageAndActualPath(path)
|
||||
storage, actualPath, err := op.GetStorageAndActualPath(path)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
return operations.MakeDir(ctx, storage, actualPath)
|
||||
return op.MakeDir(ctx, storage, actualPath)
|
||||
}
|
||||
|
||||
func move(ctx context.Context, srcPath, dstDirPath string) error {
|
||||
srcStorage, srcActualPath, err := operations.GetStorageAndActualPath(srcPath)
|
||||
srcStorage, srcActualPath, err := op.GetStorageAndActualPath(srcPath)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get src storage")
|
||||
}
|
||||
dstStorage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath)
|
||||
dstStorage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get dst storage")
|
||||
}
|
||||
if srcStorage.GetStorage() != dstStorage.GetStorage() {
|
||||
return errors.WithStack(errs.MoveBetweenTwoStorages)
|
||||
}
|
||||
return operations.Move(ctx, srcStorage, srcActualPath, dstDirActualPath)
|
||||
return op.Move(ctx, srcStorage, srcActualPath, dstDirActualPath)
|
||||
}
|
||||
|
||||
func rename(ctx context.Context, srcPath, dstName string) error {
|
||||
storage, srcActualPath, err := operations.GetStorageAndActualPath(srcPath)
|
||||
storage, srcActualPath, err := op.GetStorageAndActualPath(srcPath)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
return operations.Rename(ctx, storage, srcActualPath, dstName)
|
||||
return op.Rename(ctx, storage, srcActualPath, dstName)
|
||||
}
|
||||
|
||||
func remove(ctx context.Context, path string) error {
|
||||
storage, actualPath, err := operations.GetStorageAndActualPath(path)
|
||||
storage, actualPath, err := op.GetStorageAndActualPath(path)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
return operations.Remove(ctx, storage, actualPath)
|
||||
return op.Remove(ctx, storage, actualPath)
|
||||
}
|
||||
|
||||
func other(ctx context.Context, args model.FsOtherArgs) (interface{}, error) {
|
||||
storage, actualPath, err := operations.GetStorageAndActualPath(args.Path)
|
||||
storage, actualPath, err := op.GetStorageAndActualPath(args.Path)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "failed get storage")
|
||||
}
|
||||
args.Path = actualPath
|
||||
return operations.Other(ctx, storage, args)
|
||||
return op.Other(ctx, storage, args)
|
||||
}
|
||||
|
Reference in New Issue
Block a user