X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d7c4d1248587e87ad5320c6f1df66e8d422ea3aa..5b8731873ea8c0e5e9e35ff54ef075fe200cc749:/src/com/owncloud/android/operations/SynchronizeFolderOperation.java diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 433a0908..f85e4e7f 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -37,7 +37,7 @@ import android.content.Context; import android.content.Intent; import com.owncloud.android.Log_OC; -import com.owncloud.android.datamodel.DataStorageManager; +import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.syncadapter.FileSyncService; @@ -74,7 +74,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { private boolean mUpdateFolderProperties; /** Access to the local database */ - private DataStorageManager mStorageManager; + private FileDataStorageManager mStorageManager; /** Account where the file to synchronize belongs */ private Account mAccount; @@ -114,7 +114,7 @@ public class SynchronizeFolderOperation extends RemoteOperation { long currentSyncTime, boolean updateFolderProperties, boolean syncFullAccount, - DataStorageManager dataStorageManager, + FileDataStorageManager dataStorageManager, Account account, Context context ) { mLocalFolder = folder; @@ -206,9 +206,9 @@ public class SynchronizeFolderOperation extends RemoteOperation { Log_OC.i(TAG, "Synchronized " + mAccount.name + remotePath + ": " + result.getLogMessage()); } else { if (result.isException()) { - Log_OC.e(TAG, "Synchroned " + mAccount.name + remotePath + ": " + result.getLogMessage(), result.getException()); + Log_OC.e(TAG, "Synchronized " + mAccount.name + remotePath + ": " + result.getLogMessage(), result.getException()); } else { - Log_OC.e(TAG, "Synchroned " + mAccount.name + remotePath + ": " + result.getLogMessage()); + Log_OC.e(TAG, "Synchronized " + mAccount.name + remotePath + ": " + result.getLogMessage()); } } @@ -327,12 +327,16 @@ public class SynchronizeFolderOperation extends RemoteOperation { private void removeObsoleteFiles() { mChildren = mStorageManager.getDirectoryContent(mLocalFolder); OCFile file; - String currentSavePath = FileStorageUtils.getSavePath(mAccount.name); for (int i=0; i < mChildren.size(); ) { file = mChildren.get(i); if (file.getLastSyncDateForProperties() != mCurrentSyncTime) { - Log_OC.d(TAG, "removing file: " + file); - mStorageManager.removeFile(file, (file.isDown() && file.getStoragePath().startsWith(currentSavePath))); + if (file.isDirectory()) { + Log_OC.d(TAG, "removing folder: " + file); + mStorageManager.removeDirectory(file, true, true); + } else { + Log_OC.d(TAG, "removing file: " + file); + mStorageManager.removeFile(file, true); + } mChildren.remove(i); } else { i++;