Migrator for servlist_ in the installers

This commit is contained in:
Berke Viktor 2013-03-23 17:06:19 +01:00
parent 96fe6bf2ca
commit c6ead740c8
2 changed files with 54 additions and 0 deletions

View File

@ -240,6 +240,24 @@ begin
Result := 1; Result := 1;
end; end;
/////////////////////////////////////////////////////////////////////
procedure MigrateServlist();
begin
FileCopy(ExpandConstant('{userappdata}\HexChat\servlist_.conf'), ExpandConstant('{userappdata}\HexChat\servlist.conf'), True);
end;
/////////////////////////////////////////////////////////////////////
function OldServlistCheck(): Boolean;
begin
if FileExists(ExpandConstant('{userappdata}\HexChat\servlist_.conf')) then
Result := True
else
Result := False
end;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep); procedure CurStepChanged(CurStep: TSetupStep);
begin begin
@ -253,8 +271,17 @@ begin
end; end;
DeleteFile(ExpandConstant('{app}\portable-mode')); DeleteFile(ExpandConstant('{app}\portable-mode'));
end; end;
if (CurStep=ssPostInstall) then
begin
if OldServlistCheck() then begin
if SuppressibleMsgBox('Would you like to copy your old HexChat network list (servlist_.conf) to the new name (servlist.conf)? Make sure you remove servlist_.conf when you no longer need it.', mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
MigrateServlist();
end; end;
end; end;
end;
end;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// Importing LoadSkin API from ISSkin.DLL // Importing LoadSkin API from ISSkin.DLL

View File

@ -239,6 +239,24 @@ begin
Result := 1; Result := 1;
end; end;
/////////////////////////////////////////////////////////////////////
procedure MigrateServlist();
begin
FileCopy(ExpandConstant('{userappdata}\HexChat\servlist_.conf'), ExpandConstant('{userappdata}\HexChat\servlist.conf'), True);
end;
/////////////////////////////////////////////////////////////////////
function OldServlistCheck(): Boolean;
begin
if FileExists(ExpandConstant('{userappdata}\HexChat\servlist_.conf')) then
Result := True
else
Result := False
end;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep); procedure CurStepChanged(CurStep: TSetupStep);
begin begin
@ -252,8 +270,17 @@ begin
end; end;
DeleteFile(ExpandConstant('{app}\portable-mode')); DeleteFile(ExpandConstant('{app}\portable-mode'));
end; end;
if (CurStep=ssPostInstall) then
begin
if OldServlistCheck() then begin
if SuppressibleMsgBox('Would you like to copy your old HexChat network list (servlist_.conf) to the new name (servlist.conf)? Make sure you remove servlist_.conf when you no longer need it.', mbConfirmation, MB_YESNO or MB_DEFBUTTON2, IDNO) = IDYES then
MigrateServlist();
end; end;
end; end;
end;
end;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// Importing LoadSkin API from ISSkin.DLL // Importing LoadSkin API from ISSkin.DLL