From cb1e07f93381f155db951c35bf3e569c116a89ba Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sun, 28 Apr 2024 08:45:07 +0300 Subject: [PATCH] UI: OsUtil::restart*: Fix args handling --- src/ui/util/osutil.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/util/osutil.cpp b/src/ui/util/osutil.cpp index f82c426e..26207873 100644 --- a/src/ui/util/osutil.cpp +++ b/src/ui/util/osutil.cpp @@ -177,7 +177,7 @@ bool OsUtil::allowOtherForegroundWindows() void OsUtil::restartClient(const QString &installerPath) { QStringList args = QCoreApplication::arguments(); - args.insert(0, installerPath); + args.replace(0, FileUtil::toNativeSeparators(installerPath)); // replace a program path QProcess::startDetached("delay-start.bat", args); @@ -187,7 +187,9 @@ void OsUtil::restartClient(const QString &installerPath) void OsUtil::restart() { const QString appFilePath = QCoreApplication::applicationFilePath(); - const QStringList args = QCoreApplication::arguments(); + + QStringList args = QCoreApplication::arguments(); + args.removeFirst(); // remove a program path qApp->connect(qApp, &QObject::destroyed, [=] { QProcess::startDetached(appFilePath, args); });