we now ask the user if he/she want to remove a previously installed version under windows
This commit is contained in:
		
							parent
							
								
									e1be750f62
								
							
						
					
					
						commit
						5639faaa01
					
				
					 1 changed files with 49 additions and 0 deletions
				
			
		
							
								
								
									
										49
									
								
								gajim.iss
									
										
									
									
									
								
							
							
						
						
									
										49
									
								
								gajim.iss
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -13,6 +13,7 @@ Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixe
 | 
			
		|||
 | 
			
		||||
[Tasks]
 | 
			
		||||
Name: desktopicon; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Components: main
 | 
			
		||||
Name: removeprevious; Description: "Remouve previously installed version"; GroupDescription: "Previous install:"; Components: main; Check: IsAlreadyInstalled('Gajim');
 | 
			
		||||
 | 
			
		||||
[Files]
 | 
			
		||||
Source: "dist\*.pyd"; DestDir: "{app}\src"
 | 
			
		||||
| 
						 | 
				
			
			@ -31,3 +32,51 @@ Name: "{userdesktop}\Gajim"; Filename: "{app}\src\gajim.exe"; WorkingDir: "{app}
 | 
			
		|||
 | 
			
		||||
[Run]
 | 
			
		||||
Filename: "{app}\src\gajim.exe"; Description: "Launch application"; Flags: postinstall nowait skipifsilent
 | 
			
		||||
 | 
			
		||||
[Code]
 | 
			
		||||
 | 
			
		||||
function GetUninstallPath( AppID: String ): String;
 | 
			
		||||
var
 | 
			
		||||
   sPrevPath: String;
 | 
			
		||||
begin
 | 
			
		||||
  sPrevPath := '';
 | 
			
		||||
  if not RegQueryStringValue( HKLM,
 | 
			
		||||
    'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1',
 | 
			
		||||
    'UninstallString', sPrevpath) then
 | 
			
		||||
    RegQueryStringValue( HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1' ,
 | 
			
		||||
      'UninstallString', sPrevpath);
 | 
			
		||||
 | 
			
		||||
  Result := sPrevPath;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function IsAlreadyInstalled( AppID: String ): Boolean;
 | 
			
		||||
var
 | 
			
		||||
	sPrevPath: String;
 | 
			
		||||
begin
 | 
			
		||||
  sPrevPath := GetUninstallPath( AppID );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if ( Length(sPrevPath) > 0 ) then
 | 
			
		||||
    Result:=true
 | 
			
		||||
  else
 | 
			
		||||
    Result:=false;
 | 
			
		||||
 end;
 | 
			
		||||
 | 
			
		||||
procedure CurStepChanged(CurStep: TSetupStep);
 | 
			
		||||
var
 | 
			
		||||
	sUninstPath: String;
 | 
			
		||||
	sPrevID: String;
 | 
			
		||||
	ResultCode: Integer;
 | 
			
		||||
begin
 | 
			
		||||
  if CurStep = ssInstall then
 | 
			
		||||
  begin
 | 
			
		||||
    sPrevID := 'Gajim';
 | 
			
		||||
    sUninstPath := GetUninstallPath( sprevID );
 | 
			
		||||
 | 
			
		||||
    if ( Length(sUninstPath) > 0 ) then
 | 
			
		||||
    begin
 | 
			
		||||
      sUninstPath := RemoveQuotes(sUninstPath);
 | 
			
		||||
      Exec( RemoveQuotes(sUninstPath), '/silent', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
 | 
			
		||||
    end;
 | 
			
		||||
  end;
 | 
			
		||||
end;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue