diff options
Diffstat (limited to 'src/DownloadManager.cpp')
| -rw-r--r-- | src/DownloadManager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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)) { |
