- DeleteMethod delete = null;
- try {
- delete = new DeleteMethod(client.getBaseUri() + WebdavUtils.encodePath(mFileToRemove.getRemotePath()));
- int status = client.executeMethod(delete, REMOVE_READ_TIMEOUT, REMOVE_CONNECTION_TIMEOUT);
- if (delete.succeeded() || status == HttpStatus.SC_NOT_FOUND) {
- mDataStorageManager.removeFile(mFileToRemove, true, mDeleteLocalCopy);
+
+ mFileToRemove = getStorageManager().getFileByPath(mRemotePath);
+
+ boolean localRemovalFailed = false;
+ if (!mOnlyLocalCopy) {
+ RemoveRemoteFileOperation operation = new RemoveRemoteFileOperation(mRemotePath);
+ result = operation.execute(client);
+ if (result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND) {
+ localRemovalFailed = !(getStorageManager().removeFile(mFileToRemove, true, true));