From 70c663008b974aa0abcc68d8bce3522d1753fda8 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Wed, 21 Nov 2012 14:48:34 +0100 Subject: [PATCH] Fixed rename of local copy of files --- src/com/owncloud/android/operations/RenameFileOperation.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/owncloud/android/operations/RenameFileOperation.java b/src/com/owncloud/android/operations/RenameFileOperation.java index d5af9767..a2d3b300 100644 --- a/src/com/owncloud/android/operations/RenameFileOperation.java +++ b/src/com/owncloud/android/operations/RenameFileOperation.java @@ -168,9 +168,11 @@ public class RenameFileOperation extends RemoteOperation { // try to rename the local copy of the file if (mFile.isDown()) { File f = new File(mFile.getStoragePath()); - String newStoragePath = f.getParent() + mNewName; - if (f.renameTo(new File(newStoragePath))) { - mFile.setStoragePath(newStoragePath); + String parentStoragePath = f.getParent(); + if (!parentStoragePath.endsWith(File.separator)) + parentStoragePath += File.separator; + if (f.renameTo(new File(parentStoragePath + mNewName))) { + mFile.setStoragePath(parentStoragePath + mNewName); } // else - NOTHING: the link to the local file is kept although the local name can't be updated // TODO - study conditions when this could be a problem -- 2.11.0