Skip to content

Commit 243eccc

Browse files
committed
1) Delete the MyAppVersion key from the Windows registry during the installation or upgrade process.
2) Remove the logic that checks if a 32-bit or 64-bit version of the installer is already installed. Trying to remove 'vX' from start menu Testing 2 Testing 3
1 parent 2f49500 commit 243eccc

File tree

1 file changed

+27
-59
lines changed

1 file changed

+27
-59
lines changed

pkg/win32/installer.iss.in

Lines changed: 27 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#define MyAppArchitecturesMode "x64"
99
#define MyAppVCDist MYAPP_VCDIST
1010
#define MyAppInvalidPath "Please provide a valid path."
11-
#define MyAppErrorMsgIsWin32 "You already have a 32 bit installation of pgAdmin 4. Please uninstall this before installing the 64 bit version."
12-
#define MyAppErrorMsgIsWin64 "You already have a 64 bit installation of pgAdmin 4. Please uninstall this before installing the 32 bit version."
1311
#define MinimumWindowsVer "6.2.9200"
1412

1513
[Setup]
@@ -51,7 +49,7 @@ english.NewerVersionExists=A newer version of {#MyAppName}
5149
english.InvalidPath={#MyAppInvalidPath}
5250

5351
[Icons]
54-
Name: {group}\{#MyAppName} {#MyAppVersion}; Filename: {app}\runtime\{#MyAppExeName}; IconFilename: {app}\pgAdmin4.ico; WorkingDir: {app}\runtime;
52+
Name: {group}\{#MyAppName}; Filename: {app}\runtime\{#MyAppExeName}; IconFilename: {app}\pgAdmin4.ico; WorkingDir: {app}\runtime;
5553

5654
[Files]
5755
Source: "..\..\win-build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
@@ -60,10 +58,10 @@ Source: "..\..\win-build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdi
6058
Filename: "{app}\installer\{#MyAppVCDist}"; StatusMsg: "VC runtime redistributable package"; Parameters: "/passive /verysilent /norestart"; Check: InstallVC;
6159

6260
[Registry]
63-
Root: HKA; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekeyifempty
64-
Root: HKA; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; Flags: uninsdeletekey
65-
Root: HKA; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
66-
Root: HKA; Subkey: "Software\{#MyAppName}\{#MyAppVersion}"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppFullVersion}"
61+
Root: HKA; Subkey: "Software\{#MyAppName}"; Flags: uninsdeletekeyifempty
62+
Root: HKA; Subkey: "Software\{#MyAppName}"; Flags: uninsdeletekey
63+
Root: HKA; Subkey: "Software\{#MyAppName}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
64+
Root: HKA; Subkey: "Software\{#MyAppName}"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppFullVersion}"
6765

6866
[Code]
6967
var
@@ -148,65 +146,35 @@ end;
148146
function CheckPgAdminAlreadyInstalled: Boolean;
149147
var
150148
Version: String;
151-
InstallationFound: Boolean;
152149
begin
153-
InstallationFound := False;
154-
// Check the installation mode 64 or 32 bit of installer
155-
if Is64BitInstallMode then
150+
if RegValueExists(HKLM64,'Software\{#MyAppName}', 'Version') then
156151
begin
157-
158-
// Check if pgAdmin 32 bit is already installed
159-
RegQueryStringValue(HKLM32,'Software\{#MyAppName}\{#MyAppVersion}', 'Version', Version);
160-
161-
// If version is found then shouldn't install 64bit - abort
162-
if Length(Version) > 0 then
152+
MsgBox('Value Exist in HKLM64', mbInformation, MB_OK);
153+
end;
154+
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}', 'Version') then
155+
begin
156+
MsgBox('(v' + Version + ') is installed', mbInformation, MB_OK);
157+
UpgradeMode := True;
158+
RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}', 'Version', Version);
159+
MsgBox(Version, mbInformation, MB_OK);
160+
RegQueryStringValue(HKLM64,'Software\{#MyAppName}', 'Version', Version);
161+
MsgBox('{#MyAppFullVersion}', mbInformation, MB_OK);
162+
if CompareVersions(Version, '{#MyAppFullVersion}') = 1 then
163+
begin
164+
MsgBox(ExpandConstant('{cm:NewerVersionExists}' + '(v' + Version + ') is already installed' ), mbInformation, MB_OK);
165+
Result := False;
166+
end
167+
else
163168
begin
164-
MsgBox(ExpandConstant('{#MyAppErrorMsgIsWin32}'), mbCriticalError, MB_OK);
165-
Result := False;
166-
InstallationFound := True;
169+
MsgBox('Version Mismatch', mbInformation, MB_OK);
170+
Result := True;
167171
end;
168-
end
169-
else
170-
begin
171-
// Suppose system is running a 32-bit version of Windows then no need to check HKLM64 in RegQueryStringValue
172-
// So IsWin64 - will make sure its should only execute on 64-bit version of windows.
173-
if IsWin64 then
174-
begin
175-
// Check if pgAdmin 64 bit is already installed
176-
RegQueryStringValue(HKLM64,'Software\{#MyAppName}\{#MyAppVersion}', 'Version', Version);
177-
178-
// If version is found the shouldn't install 32bit - abort
179-
if Length(Version) > 0 then
180-
begin
181-
MsgBox(ExpandConstant('{#MyAppErrorMsgIsWin64}'), mbCriticalError, MB_OK);
182-
Result := False;
183-
InstallationFound := True;
184-
end;
185-
end;
186-
end;
187-
188-
if not (InstallationFound) then
189-
begin
190-
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version') then
191-
begin
192-
UpgradeMode := True;
193-
RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\{#MyAppName}\{#MyAppVersion}', 'Version', Version);
194-
if CompareVersions(Version, '{#MyAppFullVersion}') = 1 then
195-
begin
196-
MsgBox(ExpandConstant('{cm:NewerVersionExists}' + '(v' + Version + ') is already installed' ), mbInformation, MB_OK);
197-
Result := False;
198-
end
199-
else
200-
begin
201-
Result := True;
202-
end;
203-
end;
204172
end;
205173

206-
if ( not (InstallationFound) and not (UpgradeMode) ) then
174+
if ( not (UpgradeMode) ) then
207175
begin
208-
// This is required as it will be passed on to the InitializeSetup function
209-
Result := True;
176+
// This is required as it will be passed on to the InitializeSetup function
177+
Result := True;
210178
end;
211179
end;
212180

0 commit comments

Comments
 (0)