summaryrefslogtreecommitdiffstats
path: root/src/DownloadManager.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-08 13:17:12 +0100
committerJonathan Bauer2011-03-08 13:17:12 +0100
commit137022b7f0e2f38f3f517fd34954b3518114c920 (patch)
treeeb7717e8b42f0c2ac618be6eb51fdb7320227639 /src/DownloadManager.cpp
parentfirst fixes (diff)
downloadfbgui-137022b7f0e2f38f3f517fd34954b3518114c920.tar.gz
fbgui-137022b7f0e2f38f3f517fd34954b3518114c920.tar.xz
fbgui-137022b7f0e2f38f3f517fd34954b3518114c920.zip
first downloadDir fix
Diffstat (limited to 'src/DownloadManager.cpp')
-rw-r--r--src/DownloadManager.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp
index ce0e82a..7ab9333 100644
--- a/src/DownloadManager.cpp
+++ b/src/DownloadManager.cpp
@@ -1,4 +1,5 @@
#include "DownloadManager.h"
+//#include <QDir>
int DownloadManager::downloaded = 0;
// ----------------------------------------------------------------------------------------
@@ -46,8 +47,10 @@ void DownloadManager::startNextDownload()
// Get filename from URL.
QString tmp = url.path();
tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1);
- outfile.setFileName(downloadDirectory.path() + "/" + tmp);
- if (debug) qDebug() << "DM: Absolute path: " << downloadDirectory.path() + "/" + tmp;
+ if (debug) qDebug() << "Extracted " << tmp << "from " << url.toString();
+ // TODO: check for if relative path, if so prepend binPath
+ outfile.setFileName(downloadPath + "/" + tmp);
+ if (debug) qDebug() << "DM: Absolute path: " << downloadPath + "/" + tmp;
if (outfile.exists()){
if (debug) qDebug() << "File already exists. Skipping: " << url.toString();
startNextDownload();
@@ -122,4 +125,14 @@ DownloadManager::DownloadManager()
{
qnam = new QNetworkAccessManager();
dip = false;
+ downloadDir = QDir(downloadPath);
+ // Check if downloadPath exists, if not create it.
+ if (!downloadDir.exists()){
+ if (debug) qDebug() << downloadDir.path() << "doesn't exist.";
+ QDir::current().mkdir(downloadPath);
+ }
+ qDebug() << "1";
+ if (downloadDir.exists() && debug) qDebug() << "Created download directory: " << downloadPath;
+
+
}