diff options
| author | 2014-12-06 17:33:25 -0500 | |
|---|---|---|
| committer | 2014-12-06 17:33:25 -0500 | |
| commit | 7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch) | |
| tree | a35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/UpdateSQLiteStudio/main.cpp | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/UpdateSQLiteStudio/main.cpp')
| -rw-r--r-- | SQLiteStudio3/UpdateSQLiteStudio/main.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/SQLiteStudio3/UpdateSQLiteStudio/main.cpp b/SQLiteStudio3/UpdateSQLiteStudio/main.cpp new file mode 100644 index 0000000..e5730d3 --- /dev/null +++ b/SQLiteStudio3/UpdateSQLiteStudio/main.cpp @@ -0,0 +1,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; +} |
