Installer: Fix "delay-start.bat"

This commit is contained in:
Nodir Temirkhodjaev 2024-04-28 09:04:28 +03:00
parent cb1e07f933
commit 1d6a5c743b
3 changed files with 10 additions and 3 deletions

View File

@ -67,7 +67,8 @@ Name: "portable"; Description: "{cm:Portable}"; Flags: unchecked
Source: "build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "data\{#APP_EXE_NAME}.example.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "data\qt.conf"; DestDir: "{app}"; Flags: ignoreversion
Source: "data\delay-start.bat"; DestDir: "{app}"; Flags: ignoreversion onlyifdoesntexist
Source: "data\delay-start.bat"; DestDir: "{app}"; Flags: ignoreversion
; onlyifdoesntexist
[Dirs]
Name: "{app}\Data"; Flags: uninsneveruninstall; Permissions: users-modify; Tasks: portable

View File

@ -9,7 +9,7 @@
@rem Wait for Installer's file deletion
@for /l %%i in (0,1,3) do (
timeout /t 1 > NUL
@if not exist "%INSTALLER_PATH%" goto EXIT
@if not exist %INSTALLER_PATH% goto EXIT
)
:EXIT

View File

@ -176,10 +176,14 @@ bool OsUtil::allowOtherForegroundWindows()
void OsUtil::restartClient(const QString &installerPath)
{
const QLatin1String scriptPath("delay-start.bat");
QStringList args = QCoreApplication::arguments();
args.replace(0, FileUtil::toNativeSeparators(installerPath)); // replace a program path
QProcess::startDetached("delay-start.bat", args);
qCDebug(LC) << "restartClient:" << scriptPath << args;
QProcess::startDetached(scriptPath, args);
quit("required client restart");
}
@ -191,6 +195,8 @@ void OsUtil::restart()
QStringList args = QCoreApplication::arguments();
args.removeFirst(); // remove a program path
qCDebug(LC) << "restart:" << appFilePath << args;
qApp->connect(qApp, &QObject::destroyed, [=] { QProcess::startDetached(appFilePath, args); });
quit("required restart");