mirror of
https://github.com/tnodir/fort
synced 2024-11-14 22:05:12 +00:00
UI: AutoUpdateManager: Simplify delay start script
This commit is contained in:
parent
13ecc14775
commit
3115e4a196
@ -67,7 +67,6 @@ 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
|
||||
|
||||
[Dirs]
|
||||
Name: "{app}\Data"; Flags: uninsneveruninstall; Permissions: users-modify; Tasks: portable
|
||||
@ -113,6 +112,7 @@ Type: files; Name: "{app}\qt*.*"
|
||||
Type: filesandordirs; Name: "{app}\plugins"
|
||||
Type: files; Name: "{app}\curl*.*"
|
||||
Type: files; Name: "{app}\ChangeLog"
|
||||
Type: files; Name: "{app}\delay-start.bat"
|
||||
|
||||
[Registry]
|
||||
Root: HKLM; Subkey: "System\CurrentControlSet\Services\EventLog\System\fortfw"; Flags: uninsdeletekey
|
||||
|
@ -1,16 +0,0 @@
|
||||
@rem Delayed start of the Fort Firewall client
|
||||
|
||||
@cd "%~dp0"
|
||||
@echo off
|
||||
|
||||
@set INSTALLER_PATH=%1
|
||||
@shift
|
||||
|
||||
@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
|
||||
)
|
||||
|
||||
:EXIT
|
||||
start FortFirewall.exe %*
|
@ -21,7 +21,7 @@ inline bool processAutoUpdateManager_restartClients(
|
||||
AutoUpdateManager *autoUpdateManager, const ProcessCommandArgs & /*p*/)
|
||||
{
|
||||
if (qobject_cast<AutoUpdateManagerRpc *>(autoUpdateManager)) {
|
||||
OsUtil::restartClient(autoUpdateManager->installerPath());
|
||||
OsUtil::restartClient();
|
||||
} else {
|
||||
emit autoUpdateManager->restartClients();
|
||||
}
|
||||
|
@ -174,16 +174,18 @@ bool OsUtil::allowOtherForegroundWindows()
|
||||
return AllowSetForegroundWindow(ASFW_ANY);
|
||||
}
|
||||
|
||||
void OsUtil::restartClient(const QString &installerPath)
|
||||
void OsUtil::restartClient()
|
||||
{
|
||||
const QLatin1String scriptPath("delay-start.bat");
|
||||
const QFileInfo fi(QCoreApplication::applicationFilePath());
|
||||
|
||||
QStringList args = QCoreApplication::arguments();
|
||||
args.replace(0, FileUtil::toNativeSeparators(installerPath)); // replace a program path
|
||||
const auto scriptPath = QLatin1String("cmd.exe");
|
||||
const auto command = QString("timeout /t 2 >NUL & start %1").arg(fi.fileName());
|
||||
|
||||
const QStringList args = { "/c", command };
|
||||
|
||||
qCDebug(LC) << "restartClient:" << scriptPath << args;
|
||||
|
||||
QProcess::startDetached(scriptPath, args);
|
||||
QProcess::startDetached(scriptPath, args, /*workingDirectory=*/fi.path());
|
||||
|
||||
quit("required client restart");
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
|
||||
static bool allowOtherForegroundWindows();
|
||||
|
||||
static void restartClient(const QString &installerPath);
|
||||
static void restartClient();
|
||||
static void restart();
|
||||
static void quit(const QString &reason);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user