Fixing rare crashes in the login page
[pub/Android/ownCloud.git] / src / com / owncloud / android / datamodel / FileDataStorageManager.java
index 49a88c3..7bb29d4 100644 (file)
@@ -399,7 +399,7 @@ public class FileDataStorageManager implements DataStorageManager {
         return file;
     }
     
         return file;
     }
     
-    public void removeFile(OCFile file) {
+    public void removeFile(OCFile file, boolean removeLocalCopy) {
         Uri file_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, ""+file.getFileId());
         if (getContentProvider() != null) {
             try {
         Uri file_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE, ""+file.getFileId());
         if (getContentProvider() != null) {
             try {
@@ -414,7 +414,7 @@ public class FileDataStorageManager implements DataStorageManager {
                                         ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
                                         new String[]{mAccount.name});
         }
                                         ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
                                         new String[]{mAccount.name});
         }
-        if (file.isDown()) {
+        if (file.isDown() && removeLocalCopy) {
             new File(file.getStoragePath()).delete();
         }
     }
             new File(file.getStoragePath()).delete();
         }
     }