Installer migrator functions for xchat.conf -> hexchat.conf
This commit is contained in:
		
							parent
							
								
									0481433d69
								
							
						
					
					
						commit
						b236af84a4
					
				
					 2 changed files with 46 additions and 0 deletions
				
			
		| 
						 | 
					@ -258,6 +258,21 @@ begin
 | 
				
			||||||
		Result := 1;
 | 
							Result := 1;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					procedure MigrateConf();
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  FileCopy(ExpandConstant('{userappdata}\HexChat\xchat.conf'), ExpandConstant('{userappdata}\HexChat\hexchat.conf'), True);
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					function ConfExistCheck(): Boolean;
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  if FileExists(ExpandConstant('{userappdata}\HexChat\xchat.conf')) then
 | 
				
			||||||
 | 
					    Result := True
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    Result := False
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/////////////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////////////
 | 
				
			||||||
procedure CurStepChanged(CurStep: TSetupStep);
 | 
					procedure CurStepChanged(CurStep: TSetupStep);
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
| 
						 | 
					@ -271,6 +286,14 @@ begin
 | 
				
			||||||
			end;
 | 
								end;
 | 
				
			||||||
			DeleteFile(ExpandConstant('{app}\portable-mode'));
 | 
								DeleteFile(ExpandConstant('{app}\portable-mode'));
 | 
				
			||||||
		end;
 | 
							end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (CurStep=ssPostInstall) then
 | 
				
			||||||
 | 
							begin
 | 
				
			||||||
 | 
								if ConfExistCheck() then begin
 | 
				
			||||||
 | 
									if SuppressibleMsgBox('Would you like to copy your old HexChat configuration file (xchat.conf) to the new name (hexchat.conf)? Make sure you remove xchat.conf when you no longer need it.', mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
 | 
				
			||||||
 | 
										MigrateConf();
 | 
				
			||||||
 | 
								end;
 | 
				
			||||||
 | 
							end;
 | 
				
			||||||
	end;
 | 
						end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -259,6 +259,21 @@ begin
 | 
				
			||||||
		Result := 1;
 | 
							Result := 1;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					procedure MigrateConf();
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  FileCopy(ExpandConstant('{userappdata}\HexChat\xchat.conf'), ExpandConstant('{userappdata}\HexChat\hexchat.conf'), True);
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					function ConfExistCheck(): Boolean;
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  if FileExists(ExpandConstant('{userappdata}\HexChat\xchat.conf')) then
 | 
				
			||||||
 | 
					      Result := True
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    Result := False
 | 
				
			||||||
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/////////////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////////////
 | 
				
			||||||
procedure CurStepChanged(CurStep: TSetupStep);
 | 
					procedure CurStepChanged(CurStep: TSetupStep);
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
| 
						 | 
					@ -272,6 +287,14 @@ begin
 | 
				
			||||||
			end;
 | 
								end;
 | 
				
			||||||
			DeleteFile(ExpandConstant('{app}\portable-mode'));
 | 
								DeleteFile(ExpandConstant('{app}\portable-mode'));
 | 
				
			||||||
		end;
 | 
							end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (CurStep=ssPostInstall) then
 | 
				
			||||||
 | 
							begin
 | 
				
			||||||
 | 
								if ConfExistCheck() then begin
 | 
				
			||||||
 | 
									if SuppressibleMsgBox('Would you like to copy your old HexChat configuration file (xchat.conf) to the new name (hexchat.conf)? Make sure you remove xchat.conf when you no longer need it.', mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
 | 
				
			||||||
 | 
										MigrateConf();
 | 
				
			||||||
 | 
								end;
 | 
				
			||||||
 | 
							end;
 | 
				
			||||||
	end;
 | 
						end;
 | 
				
			||||||
end;
 | 
					end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue