diff options
author | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-18 09:51:39 +0200 |
---|---|---|
committer | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-18 09:51:39 +0200 |
commit | d52c505daaef53cd1c039c1d2b993b7d389c9d94 (patch) | |
tree | 1a9fb70388d3c34d8e12cf0f7b2bf8cdce90fdf8 /client/main.cpp | |
parent | 036dd14e811bd84dea65264a91f11a489538f1b1 (diff) |
FIX: infinite uploading issue, download speed issue
Diffstat (limited to 'client/main.cpp')
-rw-r--r-- | client/main.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/client/main.cpp b/client/main.cpp index 95b1cba..ce83fcb 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -1,8 +1,10 @@ #ifdef WIN32 + #define ClientName "client.exe" #define UpdaterName "updater.exe" #define PathSlash "\\" #else + #define ClientName "client" #define UpdaterName "updater" #define PathSlash "/" #endif @@ -10,8 +12,9 @@ #include <QProcess> #include <QString> #include <string> -#include "ProxyClientApp.h" #include "client.h" +#include "ProxyClientApp.h" +#include "Utility.h" using std::string; @@ -35,19 +38,27 @@ int main(int argc, char *argv[]) // check if the client should be updated QFileInfo newClient(dir + PathSlash + "client.bin.latest"); + QFileInfo client(dir + PathSlash + ClientName); if (newClient.exists()) - { - Logger::Info("New client version found!\n"); - QString updater = dir + PathSlash + UpdaterName; - if (QProcess::startDetached(updater)) - { - Logger::Info("Updater launched\n"); - return 0; - } - else - { - Logger::Error("Can't launch updater to update client app\n"); - } + { + QString clentName = client.fileName(); + QString newClientName = newClient.fileName(); + QByteArray md5old = md5_sum(clentName); + QByteArray md5new = md5_sum(newClientName); + if (md5old != md5new) + { + Logger::Info("New client version found!\n"); + QString updater = dir + PathSlash + UpdaterName; + if (QProcess::startDetached(updater)) + { + Logger::Info("Updater launched\n"); + return 0; + } + else + { + Logger::Error("Can't launch updater to update client app\n"); + } + } } // check if initial config exists (config.cfg) // without it application is useless |