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;
*/
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;
}
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() {
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());