X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/80448dc19218e243872ba04a960661e29f86c67b..082c11a1e3bf555139072b534c3e1f2b714e62f8:/src/com/owncloud/android/operations/UploadFileOperation.java diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java index 38a4d71d..1be103b6 100644 --- a/src/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/com/owncloud/android/operations/UploadFileOperation.java @@ -242,12 +242,16 @@ public class UploadFileOperation extends RemoteOperation { } else { // FileUploader.LOCAL_BEHAVIOUR_MOVE fileToMove = originalFile; } - if (!expectedFile.equals(fileToMove) && !fileToMove.renameTo(expectedFile)) { - mFile.setStoragePath(null); // forget the local file - // by now, treat this as a success; the file was uploaded; the user won't like that the local file is not linked, but this should be a veeery rare fail; - // the best option could be show a warning message (but not a fail) - //result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_MOVED); - //return result; + if (!expectedFile.equals(fileToMove)) { + File expectedFolder = expectedFile.getParentFile(); + expectedFolder.mkdirs(); + if (!expectedFolder.isDirectory() || !fileToMove.renameTo(expectedFile)) { + mFile.setStoragePath(null); // forget the local file + // by now, treat this as a success; the file was uploaded; the user won't like that the local file is not linked, but this should be a veeery rare fail; + // the best option could be show a warning message (but not a fail) + //result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_MOVED); + //return result; + } } } }