Переглянути джерело

Fixed lost local copy of file when moved into a folder that is not created in the local file system yet

David A. Velasco 10 роки тому
батько
коміт
679c7ed157

+ 6 - 1
src/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -718,7 +718,12 @@ public class FileDataStorageManager {
             File localFile = new File(localPath);
             boolean renamed = false;
             if (localFile.exists()) {
-                renamed = localFile.renameTo(new File(defaultSavePath + targetPath));
+                File targetFile = new File(defaultSavePath + targetPath);
+                File targetFolder = targetFile.getParentFile();
+                if (!targetFolder.exists()) {
+                    targetFolder.mkdirs();
+                }
+                renamed = localFile.renameTo(targetFile);
             }
             Log_OC.d(TAG, "Local file RENAMED : " + renamed);