mirror of
https://github.com/owncloud/android-library.git
synced 2026-08-16 10:53:06 +00:00
Updated CopyRemoteFileOperation and verified with the unit tests
This commit is contained in:
committed by
David A. Velasco
parent
8633efbb49
commit
2970b54e7c
@@ -24,6 +24,7 @@
|
||||
|
||||
package com.owncloud.android.lib.resources.files;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
@@ -61,6 +62,7 @@ public class CopyRemoteFileOperation extends RemoteOperation {
|
||||
private String mTargetRemotePath;
|
||||
|
||||
private boolean mOverwrite;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,10 +73,9 @@ public class CopyRemoteFileOperation extends RemoteOperation {
|
||||
* @param srcRemotePath Remote path of the file/folder to move.
|
||||
* @param targetRemotePath Remove path desired for the file/folder after moving it.
|
||||
*/
|
||||
public CopyRemoteFileOperation(
|
||||
String srcRemotePath, String targetRemotePath, boolean overwrite
|
||||
public CopyRemoteFileOperation(Context context, String srcRemotePath, String targetRemotePath, boolean overwrite
|
||||
) {
|
||||
|
||||
mContext = context;
|
||||
mSrcRemotePath = srcRemotePath;
|
||||
mTargetRemotePath = targetRemotePath;
|
||||
mOverwrite = overwrite;
|
||||
@@ -107,6 +108,10 @@ public class CopyRemoteFileOperation extends RemoteOperation {
|
||||
return new RemoteOperationResult(ResultCode.INVALID_COPY_INTO_DESCENDANT);
|
||||
}
|
||||
|
||||
if (!new ExistenceCheckRemoteOperation(mSrcRemotePath, mContext, Boolean.FALSE).run(getClient()).isSuccess()) {
|
||||
return new RemoteOperationResult(ResultCode.FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
/// perform remote operation
|
||||
CopyMethod copyMethod = null;
|
||||
RemoteOperationResult result = null;
|
||||
|
||||
Reference in New Issue
Block a user