check directory write access before polling for downloads
authorKonrad Rosenbaum <konrad@silmor.de>
Mon, 5 Aug 2013 06:00:40 +0000 (08:00 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Mon, 5 Aug 2013 06:00:40 +0000 (08:00 +0200)
aurora/dloader/aurora.cpp

index 6293538..969580c 100644 (file)
@@ -16,6 +16,7 @@
 #include <QSettings>
 #include <QTimer>
 #include <QDateTime>
+#include <QDir>
 
 struct AuroraUpdater::AuroraPrivate
 {
@@ -175,6 +176,11 @@ void Aurora::startPoll(int intervalInSeconds)
                         d->state=Initializing;
                 qDebug()<<"Aurora: Stopping Timer.";
         }
+        QFileInfo dir(qApp->applicationDirPath());
+        if(!dir.exists() || !dir.isDir() || !dir.isWritable()){
+                qDebug()<<"Aurora: install directory of this instance is not writable, no use in polling.";
+                return;
+        }
         if(!d->url.isValid() || d->indexfile.isEmpty()){
                 qDebug()<<"Aurora: no valid URL and/or index file, cannot poll.";
                 return;