diff --git a/UpdaterWindow.cpp b/UpdaterWindow.cpp index 53a08823..3cc1f37d 100644 --- a/UpdaterWindow.cpp +++ b/UpdaterWindow.cpp @@ -64,7 +64,7 @@ UpdaterWindow::~UpdaterWindow() void UpdaterWindow::checkForUpdates() { - QString filename=QApplication::applicationDirPath()+QDir::separator()+"update.xml"; + QString filename=QApplication::applicationDirPath()+"/update.xml"; // Check updates.xml file if it's still recent.. if (QFile::exists(filename)) { QFileInfo fi(filename); @@ -99,10 +99,8 @@ void UpdaterWindow::downloadUpdateXML() void UpdaterWindow::dataReceived() { - //HttpStatusCodeAttribute QString rs=reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString(); if (rs!="200") return; - //QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); QByteArray read=reply->read(reply->bytesAvailable()); qDebug() << "Received" << read.size() << "bytes"; @@ -151,9 +149,9 @@ void UpdaterWindow::requestFile() requestmode=RM_GetFile; - QString path=QApplication::applicationDirPath()+QDir::separator()+"Download"; - QDir().mkdir(path); - path+=QDir::separator()+filename; + QString path=QApplication::applicationDirPath()+"/Download"; + QDir().mkpath(path); + path+="/"+filename; ui->plainTextEdit->appendPlainText("Saving as "+path); file.setFileName(path); file.open(QFile::WriteOnly); @@ -278,7 +276,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply) } ui->plainTextEdit->appendPlainText(QString::number(reply->size())+" bytes received."); - QString filename=QApplication::applicationDirPath()+QDir::separator()+"update.xml"; + QString filename=QApplication::applicationDirPath()+"/update.xml"; qDebug() << filename; QFile file(filename); file.open(QFile::WriteOnly); @@ -294,13 +292,13 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply) file.close(); //HttpStatusCodeAttribute QString rs=reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString(); + qDebug() << "HTTP Status Code" << rs; bool failed=false; if (rs=="404") { qDebug() << "File not found"; failed=true; } else { - qDebug() << "StatCodeAttr" << rs; QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); if (!redirectUrl.isEmpty() && (redirectUrl!=reply->url())) { file.open(QFile::WriteOnly); //reopen file.. @@ -319,8 +317,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply) ui->plainTextEdit->appendPlainText("File size mismatch for "+update->filename); } } else { - QString path=QApplication::applicationDirPath()+QDir::separator()+"Download"; - path+=QDir::separator()+update->filename; + QString path=QApplication::applicationDirPath()+"/Download/"+update->filename; QFile f(path); f.open(QFile::ReadOnly); QCryptographicHash hash(QCryptographicHash::Sha1); @@ -349,9 +346,9 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply) QByteArray ba; QStringList update_txt; - QString apppath=QApplication::applicationDirPath()+QDir::separator(); - QString backups=apppath+"Backups"+QDir::separator(); - QString downloads=apppath+"Downloads"+QDir::separator(); + QString apppath=QApplication::applicationDirPath()+"/"; + QString backups=apppath+"Backups/"; + QString downloads=apppath+"Downloads/"; QDir().mkpath(backups); for (int i=0;iunzipped_path.isEmpty()) update->unzipped_path=path; diff --git a/common_gui.cpp b/common_gui.cpp index 642d8381..0f38ce8e 100644 --- a/common_gui.cpp +++ b/common_gui.cpp @@ -11,7 +11,7 @@ #include "windows.h" void sh_delay(int ms) { - Sleep(ms) + Sleep(ms); } #else void sh_delay(int ms)