소스 검색

Fixed rename of local copy of files

David A. Velasco 12 년 전
부모
커밋
70c663008b
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      src/com/owncloud/android/operations/RenameFileOperation.java

+ 5 - 3
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