From 69be23c5f629884465dec98efcb9d5a2678b4df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 18 Nov 2016 16:04:08 +0100 Subject: GH-1726 better failure detection for updates Instead of just checking if the new version started, make sure it is able to write its IPC key to a file and then use the key to connect to the process. --- application/UpdateController.h | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 application/UpdateController.h (limited to 'application/UpdateController.h') diff --git a/application/UpdateController.h b/application/UpdateController.h new file mode 100644 index 00000000..2b258701 --- /dev/null +++ b/application/UpdateController.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include + +class QWidget; + +class UpdateController +{ +public: + UpdateController(QWidget * parent, const QString &root, const QString updateFilesDir, GoUpdate::OperationList operations); + void installUpdates(); + +private: + void fail(); + bool rollback(); + +private: + QString m_root; + QString m_updateFilesDir; + GoUpdate::OperationList m_operations; + QWidget * m_parent; + + struct BackupEntry + { + // path where we got the new file from + QString update; + // path of what is being actually updated + QString original; + // path where the backup of the updated file was placed + QString backup; + }; + QList m_replace_backups; + QList m_delete_backups; + enum Failure + { + Replace, + Delete, + Start, + Nothing + } m_failedOperationType = Nothing; + QString m_failedFile; +}; -- cgit v1.2.3