Installer: Add global setup mutex.

This commit is contained in:
Nodir Temirkhodjaev 2021-03-31 15:42:36 +03:00
parent 98a5bd8667
commit 7beb143270
6 changed files with 16 additions and 14 deletions

View File

@ -3,8 +3,8 @@
#include SRC_PATH + "\version\fort_version.h"
#define APP_EXE_NAME "FortFirewall.exe"
#define APP_ICO_NAME "FortFirewall.ico"
#define APP_EXE_NAME APP_BASE + ".exe"
#define APP_ICO_NAME APP_BASE + ".ico"
#define APP_EXE StringChange("{app}\%exe%", "%exe%", APP_EXE_NAME)
@ -12,7 +12,8 @@
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppMutex={#APP_NAME}
SetupMutex=Global\Setup{#APP_BASE}
AppMutex={#APP_NAME},{#APP_BASE},Global\{#APP_BASE}
AppName={#APP_NAME}
AppVersion={#APP_VERSION_STR}
VersionInfoVersion={#APP_VERSION_STR}
@ -27,7 +28,7 @@ DefaultDirName={pf32}\{#APP_NAME}
AlwaysShowDirOnReadyPage=yes
AlwaysShowGroupOnReadyPage=yes
AllowNoIcons=yes
OutputBaseFilename=FortFirewall-{#APP_VERSION_STR}
OutputBaseFilename={#APP_BASE}-{#APP_VERSION_STR}
Uninstallable=not IsTaskSelected('portable')
UninstallFilesDir={app}\uninst
UninstallDisplayIcon={uninstallexe}
@ -47,7 +48,7 @@ Name: "portable"; Description: "Portable"; Flags: unchecked
[Files]
Source: "build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "FortFirewall.exe.example.ini"; DestDir: "{app}"
Source: "{#APP_EXE_NAME}.example.ini"; DestDir: "{app}"
Source: "README.portable"; DestDir: "{app}"; Tasks: portable
[Registry]

View File

@ -9,13 +9,13 @@
#define VER_PRODUCTVERSION_STR APP_VERSION_STR
#define VER_COMPANYNAME_STR APP_PUBLISHER
#define VER_FILEDESCRIPTION_STR "Fort Firewall"
#define VER_INTERNALNAME_STR "FortFirewall"
#define VER_FILEDESCRIPTION_STR APP_NAME
#define VER_INTERNALNAME_STR APP_BASE
#define VER_LEGALCOPYRIGHT_STR APP_LEGALCOPYRIGHT
#define VER_LEGALTRADEMARKS1_STR ""
#define VER_LEGALTRADEMARKS2_STR ""
#define VER_ORIGINALFILENAME_STR "FortFirewall.exe"
#define VER_PRODUCTNAME_STR "Fort Firewall"
#define VER_PRODUCTNAME_STR APP_NAME
#ifdef _DEBUG
#define VER_DEBUG (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VS_FF_DEBUG)

View File

@ -51,7 +51,7 @@ int FortSettings::appVersion() const
void FortSettings::setupGlobal()
{
// Use global settings from program's working directory.
const QSettings settings("FortFirewall.exe.ini", QSettings::IniFormat);
const QSettings settings(APP_BASE ".exe.ini", QSettings::IniFormat);
// High-DPI scale factor rounding policy
const auto dpiPolicy = settings.value("global/dpiPolicy").toString();
@ -186,7 +186,7 @@ void FortSettings::processArguments(const QStringList &args, EnvManager *envMana
void FortSettings::setupIni()
{
const QString iniPath(profilePath() + "FortFirewall.ini");
const QString iniPath(profilePath() + (APP_BASE ".ini"));
FileUtil::makePath(profilePath());
FileUtil::makePath(statPath());
@ -211,12 +211,12 @@ void FortSettings::setErrorMessage(const QString &errorMessage)
QString FortSettings::statFilePath() const
{
return statPath() + QLatin1String("FortFirewall.stat");
return statPath() + (APP_BASE ".stat");
}
QString FortSettings::confFilePath() const
{
return profilePath() + QLatin1String("FortFirewall.config");
return profilePath() + (APP_BASE ".config");
}
void FortSettings::readConfIni(FirewallConf &conf) const

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
#ifdef APP_SINGLE_INSTANCE
// Check running instance
if (!OsUtil::createGlobalMutex(APP_NAME)) {
if (!OsUtil::createGlobalMutex(APP_BASE)) {
QMessageBox::critical(nullptr, QString(), "Application is already running!");
return FORT_ERROR_INSTANCE;
}

View File

@ -13,7 +13,7 @@
namespace {
const char *const serviceName = "FortFirewallSvc";
const char *const serviceName = APP_BASE "Svc";
const char *const regCurUserRun =
R"(HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run)";

View File

@ -8,6 +8,7 @@
#define APP_VERSION 0x030400
#define APP_NAME "Fort Firewall"
#define APP_BASE "FortFirewall"
#define APP_PUBLISHER "Nodir Temirkhodjaev"
#define APP_LEGALCOPYRIGHT "Copyright (C) 2015-2021 Nodir Temirkhodjaev. All Rights Reserved."
#define APP_URL "https://github.com/tnodir/fort"