| 1 | [Setup] |
|---|
| 2 | AppName=Gajim |
|---|
| 3 | AppVerName=Gajim version 0.9.1 |
|---|
| 4 | DefaultDirName={pf}\Gajim |
|---|
| 5 | DefaultGroupName=Gajim |
|---|
| 6 | UninstallDisplayIcon={app}\src\Gajim.exe |
|---|
| 7 | Compression=lzma |
|---|
| 8 | SolidCompression=yes |
|---|
| 9 | SetupIconFile=data\pixmaps\gajim.ico |
|---|
| 10 | |
|---|
| 11 | [Components] |
|---|
| 12 | Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed |
|---|
| 13 | |
|---|
| 14 | [Tasks] |
|---|
| 15 | Name: desktopicon; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Components: main |
|---|
| 16 | Name: removeprevious; Description: "Remove previously installed version"; GroupDescription: "Previous install:"; Components: main; Check: IsAlreadyInstalled('Gajim'); |
|---|
| 17 | |
|---|
| 18 | [Files] |
|---|
| 19 | Source: "dist\*.pyd"; DestDir: "{app}\src" |
|---|
| 20 | Source: "dist\*.dll"; DestDir: "{app}\src" |
|---|
| 21 | Source: "dist\*.zip"; DestDir: "{app}\src" |
|---|
| 22 | Source: "COPYING"; DestDir: "{app}" |
|---|
| 23 | Source: "dist\gajim.exe"; DestDir: "{app}\src"; components: main |
|---|
| 24 | Source: "dist\*.glade"; DestDir: "{app}\src" |
|---|
| 25 | Source: "data\*"; DestDir: "{app}\data"; Flags: recursesubdirs |
|---|
| 26 | Source: "po\*.mo"; DestDir: "{app}\po"; Flags: recursesubdirs |
|---|
| 27 | |
|---|
| 28 | [Icons] |
|---|
| 29 | Name: "{group}\Gajim"; Filename: "{app}\src\Gajim.exe"; WorkingDir: "{app}\src" |
|---|
| 30 | Name: "{group}\Uninstall Gajim"; Filename: "{app}\unins000.exe"; WorkingDir: "{app}" |
|---|
| 31 | Name: "{userdesktop}\Gajim"; Filename: "{app}\src\gajim.exe"; WorkingDir: "{app}\src"; IconFilename: "{app}\data\pixmaps\gajim.ico"; Components: main; Tasks: desktopicon |
|---|
| 32 | |
|---|
| 33 | [Run] |
|---|
| 34 | Filename: "{app}\src\gajim.exe"; Description: "Launch application"; Flags: postinstall nowait skipifsilent |
|---|
| 35 | |
|---|
| 36 | [Code] |
|---|
| 37 | |
|---|
| 38 | function GetUninstallPath( AppID: String ): String; |
|---|
| 39 | var |
|---|
| 40 | sPrevPath: String; |
|---|
| 41 | begin |
|---|
| 42 | sPrevPath := ''; |
|---|
| 43 | if not RegQueryStringValue( HKLM, |
|---|
| 44 | 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1', |
|---|
| 45 | 'UninstallString', sPrevpath) then |
|---|
| 46 | RegQueryStringValue( HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1' , |
|---|
| 47 | 'UninstallString', sPrevpath); |
|---|
| 48 | |
|---|
| 49 | Result := sPrevPath; |
|---|
| 50 | end; |
|---|
| 51 | |
|---|
| 52 | function IsAlreadyInstalled( AppID: String ): Boolean; |
|---|
| 53 | var |
|---|
| 54 | sPrevPath: String; |
|---|
| 55 | begin |
|---|
| 56 | sPrevPath := GetUninstallPath( AppID ); |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | if ( Length(sPrevPath) > 0 ) then |
|---|
| 60 | Result:=true |
|---|
| 61 | else |
|---|
| 62 | Result:=false; |
|---|
| 63 | end; |
|---|
| 64 | |
|---|
| 65 | procedure CurStepChanged(CurStep: TSetupStep); |
|---|
| 66 | var |
|---|
| 67 | sUninstPath: String; |
|---|
| 68 | sPrevID: String; |
|---|
| 69 | ResultCode: Integer; |
|---|
| 70 | begin |
|---|
| 71 | if CurStep = ssInstall then |
|---|
| 72 | begin |
|---|
| 73 | sPrevID := 'Gajim'; |
|---|
| 74 | sUninstPath := GetUninstallPath( sprevID ); |
|---|
| 75 | |
|---|
| 76 | if ( Length(sUninstPath) > 0 ) then |
|---|
| 77 | begin |
|---|
| 78 | sUninstPath := RemoveQuotes(sUninstPath); |
|---|
| 79 | Exec( RemoveQuotes(sUninstPath), '/silent', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); |
|---|
| 80 | end; |
|---|
| 81 | end; |
|---|
| 82 | end; |
|---|