From 11f9c7bc7cb287eef7393b536b74e1371e6e8d8f Mon Sep 17 00:00:00 2001 From: aiamnezia Date: Thu, 19 Dec 2024 19:10:40 +0400 Subject: [PATCH] Move installer launch logic to client side for Windows --- client/ui/controllers/updateController.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/client/ui/controllers/updateController.cpp b/client/ui/controllers/updateController.cpp index 2888ec2d..34ad35a9 100644 --- a/client/ui/controllers/updateController.cpp +++ b/client/ui/controllers/updateController.cpp @@ -15,7 +15,8 @@ namespace #ifdef Q_OS_MACOS const QString installerPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/AmneziaVPN.dmg"; #elif defined Q_OS_WINDOWS - const QString installerPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/AmneziaVPN.exe"; + const QString installerPath = + QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/AmneziaVPN_installer.exe"; #elif defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) const QString installerPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/AmneziaVPN.tar.zip"; #endif @@ -152,9 +153,18 @@ void UpdateController::runInstaller() #if defined(Q_OS_WINDOWS) int UpdateController::runWindowsInstaller(const QString &installerPath) { - qDebug() << "Windows installer path:" << installerPath; - // TODO: Implement Windows installation logic - return -1; + // Start the installer process + qint64 pid; + bool success = QProcess::startDetached(installerPath, QStringList(), QString(), &pid); + + if (success) { + qDebug() << "Installation process started with PID:" << pid; + } else { + qDebug() << "Failed to start installation process"; + return -1; + } + + return 0; } #endif