X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/1e7e893321e3939bf773349d41efc18caad7ab99..6f1fe5ad6d8b6f49275a8e44c9631cc65b1bafc8:/src/com/owncloud/android/operations/CreateFolderOperation.java diff --git a/src/com/owncloud/android/operations/CreateFolderOperation.java b/src/com/owncloud/android/operations/CreateFolderOperation.java index b0e7ed9d..b3c17f1d 100644 --- a/src/com/owncloud/android/operations/CreateFolderOperation.java +++ b/src/com/owncloud/android/operations/CreateFolderOperation.java @@ -1,5 +1,9 @@ -/* ownCloud Android client application - * Copyright (C) 2014 ownCloud Inc. +/** + * ownCloud Android client application + * + * @author David A. Velasco + * @author masensio + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -31,9 +35,6 @@ import com.owncloud.android.utils.FileStorageUtils; /** * Access to remote operation performing the creation of a new folder in the ownCloud server. * Save the new folder in Database - * - * @author David A. Velasco - * @author masensio */ public class CreateFolderOperation extends SyncOperation implements OnRemoteOperationListener{ @@ -84,21 +85,36 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper } } - /** * Save new directory in local database */ public void saveFolderInDB() { - OCFile newDir = new OCFile(mRemotePath); - newDir.setMimetype("DIR"); - long parentId = getStorageManager().getFileByPath(FileStorageUtils.getParentPath(mRemotePath)).getFileId(); - newDir.setParentId(parentId); - newDir.setModificationTimestamp(System.currentTimeMillis()); - getStorageManager().saveFile(newDir); + if (mCreateFullPath && getStorageManager(). + getFileByPath(FileStorageUtils.getParentPath(mRemotePath)) == null){// When parent + // of remote path + // is not created + String[] subFolders = mRemotePath.split("/"); + String composedRemotePath = "/"; - Log_OC.d(TAG, "Create directory " + mRemotePath + " in Database"); + // For each antecesor folders create them recursively + for (int i=0; i