X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/27112bd200e1bf30897ae94507afeeb272e267ec..aef73a5263c94e34a38bc45ce1506651d80c7f78:/src/com/owncloud/android/operations/DownloadFileOperation.java diff --git a/src/com/owncloud/android/operations/DownloadFileOperation.java b/src/com/owncloud/android/operations/DownloadFileOperation.java index e6120d69..2704654d 100644 --- a/src/com/owncloud/android/operations/DownloadFileOperation.java +++ b/src/com/owncloud/android/operations/DownloadFileOperation.java @@ -32,9 +32,9 @@ import org.apache.commons.httpclient.methods.GetMethod; import org.apache.http.HttpStatus; import com.owncloud.android.datamodel.OCFile; -import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.operations.RemoteOperation; import com.owncloud.android.operations.RemoteOperationResult; +import com.owncloud.android.utils.FileStorageUtils; import eu.alefzero.webdav.OnDatatransferProgressListener; import eu.alefzero.webdav.WebdavClient; @@ -50,7 +50,7 @@ import android.webkit.MimeTypeMap; */ public class DownloadFileOperation extends RemoteOperation { - private static final String TAG = DownloadFileOperation.class.getCanonicalName(); + private static final String TAG = DownloadFileOperation.class.getSimpleName(); private Account mAccount; private OCFile mFile; @@ -78,11 +78,15 @@ public class DownloadFileOperation extends RemoteOperation { } public String getSavePath() { - return FileDownloader.getSavePath(mAccount.name) + mFile.getRemotePath(); + String path = mFile.getStoragePath(); // re-downloads should be done over the original file + if (path != null && path.length() > 0) { + return path; + } + return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile); } public String getTmpPath() { - return FileDownloader.getTemporalPath(mAccount.name) + mFile.getRemotePath(); + return FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath(); } public String getRemotePath() { @@ -119,7 +123,7 @@ public class DownloadFileOperation extends RemoteOperation { protected RemoteOperationResult run(WebdavClient client) { RemoteOperationResult result = null; File newFile = null; - boolean moved = false; + boolean moved = true; /// download will be performed to a temporal file, then moved to the final location File tmpFile = new File(getTmpPath());