private RemoteOperationResult grantFolderExistence(String pathToGrant){
  RemoteOperation operation=new ExistenceCheckRemoteOperation(pathToGrant,this,false);
  RemoteOperationResult result=operation.execute(mUploadClient);
  if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND && mCurrentUpload.isRemoteFolderToBeCreated()) {
    SyncOperation syncOp=new CreateFolderOperation(pathToGrant,true);
    result=syncOp.execute(mUploadClient,mStorageManager);
  }
  if (result.isSuccess()) {
    OCFile parentDir=mStorageManager.getFileByPath(pathToGrant);
    if (parentDir == null) {
      parentDir=createLocalFolder(pathToGrant);
    }
    if (parentDir != null) {
      result=new RemoteOperationResult(ResultCode.OK);
    }
 else {
      result=new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
    }
  }
  return result;
}

private RemoteOperationResult grantFolderExistence ( String pathToGrant ) { RemoteOperation operation = new ExistenceCheckRemoteOperation ( pathToGrant , this , false ) ; RemoteOperationResult result = operation . execute ( mUploadClient ) ; if ( ! result . isSuccess ( ) && result . getCode ( ) == ResultCode . FILE_NOT_FOUND && mCurrentUpload . isRemoteFolderToBeCreated ( ) ) { SyncOperation syncOp = new CreateFolderOperation ( pathToGrant , true ) ; result = syncOp . execute ( mUploadClient , mStorageManager ) ; } if ( result . isSuccess ( ) ) { OCFile parentDir = mStorageManager . getFileByPath ( pathToGrant ) ; if ( parentDir == null ) { parentDir = createLocalFolder ( pathToGrant ) ; } if ( parentDir != null ) { result = new RemoteOperationResult ( ResultCode . OK ) ; } else { result = new RemoteOperationResult ( ResultCode . UNKNOWN_ERROR ) ; } } return result ; }
checks the existence of the folder where the current file will be uploaded both in the remote server and in the local database . if the upload is set to enforce the creation of the folder , the method tries to create it both remote and locally .
