diff options
author | Jonathan Bauer | 2011-03-23 15:09:07 +0100 |
---|---|---|
committer | Jonathan Bauer | 2011-03-23 15:09:07 +0100 |
commit | dd7d35a216ff399f71a01c8e5d98f1cc22a34edf (patch) | |
tree | ec32a546cabea3952bfb85561d2c4c8ecc672282 | |
parent | file/dir checks for the file triggering (diff) | |
download | fbgui-dd7d35a216ff399f71a01c8e5d98f1cc22a34edf.tar.gz fbgui-dd7d35a216ff399f71a01c8e5d98f1cc22a34edf.tar.xz fbgui-dd7d35a216ff399f71a01c8e5d98f1cc22a34edf.zip |
download manager directory checks improvements...
-rw-r--r-- | src/downloadmanager.cpp | 26 | ||||
-rw-r--r-- | src/fbgui.cpp | 2 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index ab1b0ad..ae7504d 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -10,34 +10,40 @@ DownloadManager::DownloadManager(){ dip = false; } // ---------------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------------------- void DownloadManager::checkDownloadDirectory() { // check if downloadPath exists, if not create it. downloadDir = QDir(downloadPath); if (!downloadDir.exists()){ qxtLog->debug() << "Download directory: " << downloadDir.path() << " doesn't exist."; - QDir::current().mkdir(downloadPath); - if (downloadDir.exists()){ + // try to create the directory + if (QDir::current().mkdir(downloadPath)) qxtLog->debug() << "Created download directory: " << downloadDir.path(); - } else { qxtLog->debug() << "Failed to create directory: " << downloadDir.path(); // try to save to /tmp/fbgui downloadDir.setPath(QDir::tempPath () + "/fbgui"); if (!downloadDir.exists()){ - QDir::current().mkdir(QDir::tempPath () + "/fbgui"); - if (!downloadDir.exists()){ - // TODO: dont exit, this shouldn't happen anyway (right?) - qxtLog->debug() << "Fatal, no target for downloads. Exiting..."; + if (QDir::current().mkdir(QDir::tempPath () + "/fbgui")) + qxtLog->debug() << "Successfully created: " << downloadDir.absolutePath(); + else { + // just in case + qxtLog->debug() << "Failed to create: " << downloadDir.absolutePath(); + qxtLog->debug() << "Exiting..."; exit(EXIT_FAILURE); } } - qxtLog->debug() << "Saving downloads to: " << downloadDir.absolutePath(); + else + qxtLog->debug() << downloadDir.absolutePath() << " already exists."; } } - else qxtLog->debug() << "Download directory: " << downloadDir.path() << " exists."; + else + qxtLog->debug() << "Download directory: " << downloadDir.absolutePath() << " already exists."; + + qxtLog->debug() << "Saving downloads to: " << downloadDir.absolutePath(); + //downloadPath = downloadDir.absolutePath(); } -// ---------------------------------------------------------------------------------------- void DownloadManager::downloadFile(const QString& filename) { QUrl fileUrl(baseURL.resolved(QUrl(filename))); diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 7162e75..9be1925 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -142,7 +142,7 @@ bool fbgui::checkHost() const return false; } else{ - qxtLog->debug() << "Lookup of " << baseURL.host() << "succeeded."; + qxtLog->debug() << "Lookup of " << baseURL.host() << " succeeded."; return true; } |