From 46861b123982eff4046aa3026facb5a0c1ca4282 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 8 Mar 2011 03:31:27 +0100 Subject: more --- src/DownloadManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/DownloadManager.cpp') diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index b5c11a2..5d95afc 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -45,8 +45,14 @@ void DownloadManager::startNextDownload() QUrl url = dlQ.dequeue(); // Get filename from URL. QString tmp = url.path(); - outfile.setFileName(tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1)); - + tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1); + outfile.setFileName(downloadDirectory.path() + "/" + tmp); + if (outfile.exists()){ + if (debug) qDebug() << "File already exists. Skipping: " << url.toString(); + startNextDownload(); + return; + } + if (debug) qDebug() << "Saving " << url.toString() << "to " << outfile.fileName(); // If error upon opening, skip this file. if (!outfile.open(QIODevice::WriteOnly)) { -- cgit v1.2.3-55-g7522