Installer migrator functions for xchat.conf -> hexchat.conf

This commit is contained in:
Berke Viktor 2012-11-03 23:54:05 +01:00
parent 0481433d69
commit b236af84a4
2 changed files with 46 additions and 0 deletions

View File

@ -258,6 +258,21 @@ begin
Result := 1;
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);
begin
@ -271,6 +286,14 @@ begin
end;
DeleteFile(ExpandConstant('{app}\portable-mode'));
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;

View File

@ -259,6 +259,21 @@ begin
Result := 1;
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);
begin
@ -272,6 +287,14 @@ begin
end;
DeleteFile(ExpandConstant('{app}\portable-mode'));
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;