blob: e5730d3b448990829b7e4fb31cf7481c37589a70 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "services/updatemanager.h"
#include <QCoreApplication>
#include <QStringList>
#include <QDebug>
#include <QTimer>
#include <QDir>
#include <QTextStream>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QString path = app.applicationDirPath() + QLatin1Char('/') + UpdateManager::WIN_INSTALL_FILE;
QFile installFile(path);
if (QFileInfo(path).isReadable())
{
installFile.open(QIODevice::ReadOnly);
QTextStream inStr(&installFile);
QString option = inStr.readLine();
QString backupDir = inStr.readLine();
QString appDir = inStr.readLine();
installFile.close();
installFile.remove();
QString tempDir = app.applicationDirPath();
if (option == UpdateManager::UPDATE_OPTION_NAME)
{
bool res = UpdateManager::executeFinalStep(tempDir, backupDir, appDir);
if (res)
{
QFile doneFile(appDir + QLatin1Char('/') + UpdateManager::WIN_UPDATE_DONE_FILE);
doneFile.open(QIODevice::WriteOnly);
doneFile.close();
}
else
qCritical() << QString("Could not execute final step with root priviledges: %1").arg(UpdateManager::getStaticErrorMessage());
}
else
{
qCritical() << QString("Option passed to updater not matched: '%1' != '%2'").arg(option, UpdateManager::UPDATE_OPTION_NAME);
}
}
else
{
qCritical() << QString("Updater installation file (%1) was not readable.").arg(path);
}
return 0;
}
|