From 046f2f700300f57b19be72a6f61e4db44c4b80b4 Mon Sep 17 00:00:00 2001 From: dsm <41967334+dsm@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:21:15 +0300 Subject: [PATCH] uninstall old version if it installed before. --- contrib/InnoSetup/qucs.iss | 49 ++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/contrib/InnoSetup/qucs.iss b/contrib/InnoSetup/qucs.iss index 54f997926..f857aac7c 100755 --- a/contrib/InnoSetup/qucs.iss +++ b/contrib/InnoSetup/qucs.iss @@ -1,5 +1,5 @@ -; -; qucs.iss - inno Setup script file +; Qucs-S Inno Setup script file +; Refactored for improved readability and maintainability ; ; Copyright (C) 2005-2011 Stefan Jahn ; Copyright (C) 2014-2016 Guilherme Brondani Torri @@ -18,7 +18,7 @@ ; along with this package; see the file COPYING. If not, write to ; the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, ; Boston, MA 02110-1301, USA. -; + #ifndef RELEASE #define RELEASE "24.3.0" #endif @@ -31,37 +31,33 @@ #define TREE "..\..\build\qucs-suite\" [Setup] -AppName={# APPNAME} -AppVersion={# RELEASE} +AppName={#APPNAME} +AppVersion={#RELEASE} AppPublisher=The Qucs-S Team -AppPublisherURL={# URL} -AppSupportURL={# URL} -AppUpdatesURL={# URL} +AppPublisherURL={#URL} +AppSupportURL={#URL} +AppUpdatesURL={#URL} DefaultDirName={pf}\Qucs-S DefaultGroupName=Qucs-S AllowNoIcons=yes -LicenseFile={# TREE}\misc\gpl.rtf -OutputBaseFilename={# APPNAME}-{# RELEASE}-setup +LicenseFile={#TREE}\misc\gpl.rtf +OutputBaseFilename={#APPNAME}-{#RELEASE}-setup Compression=lzma2/max SolidCompression=yes ChangesEnvironment=yes UsePreviousAppDir=yes WizardStyle=modern -SetupIconFile={# TREE}\misc\qucs.ico - -; [Registry] -; Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: string; ValueName: QUCSDIR; ValueData: "{app}"; Flags: deletevalue createvalueifdoesntexist noerror; MinVersion: 0,4.00.1381 +SetupIconFile={#TREE}\misc\qucs.ico +Uninstallable=yes [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "{# TREE}\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs -; Source: "{# TREE}\include\*"; DestDir: "{app}\include"; Flags: ignoreversion recursesubdirs createallsubdirs -; Source: "{# TREE}\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "{# TREE}\misc\*"; DestDir: "{app}\misc"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "{# TREE}\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "{# TREE}\share\*"; DestDir: "{app}\share"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#TREE}\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#TREE}\misc\*"; DestDir: "{app}\misc"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#TREE}\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#TREE}\share\*"; DestDir: "{app}\share"; Flags: ignoreversion recursesubdirs createallsubdirs [Icons] Name: "{group}\Qucs-S Simulator"; Filename: "{app}\bin\qucs-s.exe"; IconFilename: "{app}\misc\qucs.ico"; WorkingDir: "{app}\bin" @@ -70,3 +66,16 @@ Name: "{group}\Technical Online Documentation"; Filename: "{app}\misc\docsite.ur Name: "{group}\{cm:UninstallProgram,Qucs}"; Filename: "{uninstallexe}" Name: "{userdesktop}\Qucs-S"; Filename: "{app}\bin\qucs-s.exe"; IconFilename: "{app}\misc\qucs.ico"; WorkingDir: "{app}\bin"; Tasks: desktopicon +[Code] +procedure CurStepChanged(CurStep: TSetupStep); +var + ResultCode: Integer; + Uninstall: String; +begin + if (CurStep = ssInstall) then begin + if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#APPNAME}_is1', 'UninstallString', Uninstall) then begin + MsgBox('An existing version of {#APPNAME} was detected. It will now be removed before installing the new version.', mbInformation, MB_OK); + Exec(RemoveQuotes(Uninstall), ' /SILENT', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode); + end; + end; +end;