Warn about overriding previous version.
This commit is contained in:
parent
21b8401466
commit
ced93eb58a
15
dist/win/inno/valentina.iss
vendored
15
dist/win/inno/valentina.iss
vendored
|
@ -519,6 +519,15 @@ end;
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// Version comparison on installation
|
// Version comparison on installation
|
||||||
|
|
||||||
|
function GetRegistryRootKey(): Integer;
|
||||||
|
begin
|
||||||
|
// Check if the installer is running in administrative install mode
|
||||||
|
if IsAdminInstallMode() then
|
||||||
|
Result := HKEY_LOCAL_MACHINE
|
||||||
|
else
|
||||||
|
Result := HKEY_CURRENT_USER;
|
||||||
|
end;
|
||||||
|
|
||||||
function VersionCompareAndUninstall(): Boolean;
|
function VersionCompareAndUninstall(): Boolean;
|
||||||
var
|
var
|
||||||
oldVersion: String;
|
oldVersion: String;
|
||||||
|
@ -528,10 +537,10 @@ var
|
||||||
begin
|
begin
|
||||||
tmpId := '{#emit SetupSetting("AppId")}';
|
tmpId := '{#emit SetupSetting("AppId")}';
|
||||||
Delete(tmpId,1,1);
|
Delete(tmpId,1,1);
|
||||||
if RegKeyExists(HKEY_LOCAL_MACHINE,
|
if RegKeyExists(GetRegistryRootKey(),
|
||||||
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + tmpId + '_is1') then
|
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + tmpId + '_is1') then
|
||||||
begin
|
begin
|
||||||
RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
RegQueryStringValue(GetRegistryRootKey(),
|
||||||
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + tmpId + '_is1',
|
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + tmpId + '_is1',
|
||||||
'DisplayVersion', oldVersion);
|
'DisplayVersion', oldVersion);
|
||||||
if (CompareVersion(oldVersion, '{#emit SetupSetting("AppVersion")}') < 0) then
|
if (CompareVersion(oldVersion, '{#emit SetupSetting("AppVersion")}') < 0) then
|
||||||
|
@ -543,7 +552,7 @@ begin
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + tmpId + '_is1','UninstallString', uninstaller);
|
RegQueryStringValue(GetRegistryRootKey(),'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + tmpId + '_is1','UninstallString', uninstaller);
|
||||||
If ShellExec('', uninstaller, '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
|
If ShellExec('', uninstaller, '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
|
||||||
begin
|
begin
|
||||||
// handle success if necessary; ResultCode contains the exit code
|
// handle success if necessary; ResultCode contains the exit code
|
||||||
|
|
Loading…
Reference in New Issue
Block a user