Пользователь
Сообщения: 56
Благодарности: 0
|
Профиль
|
Отправить PM
| Цитировать
 рано обрадовался... была ошибка
прописал в [Files]
Source: BeforeInstall: BackupCheck_4();
теперь вот такая ошибка... тут уже не пойму что делать!?
сам бэкап
Цитата:
#define ModVer "0.9.4"
#include "SHFileOperation.iss"
[code]
function MoveFile(const srcFile, destFile: PChar): Integer;
external 'MoveFileA@kernel32.dll stdcall';
var
BackupPage: TWizardPage;
DeleteRadioButton, MoveRadioButton, Move2RadioButton, NoneRadioButton: TNewRadioButton;
const
BackupDescText =
'Во избежание проблем совместимости и конфликтов между модификациями рекомендуется удалить уже установленные на данный момент в игровом клиенте.' #13#13 'Выберите необходимый пункт из представленных. При этом будет очищено содержимое папки "res_mods\{#ModVer}, удалена папка "res_mods\xvm" или созданы резервные копии Ваших файлов.';
DeleteDescText =
'Установщик удалит все файлы в папках.';
MoveDescText =
'Установщик сделает резервную копию всех файлов в папках.';
Move2DescText =
'Установщик сделает резервную копию только заменяемых файлов в папках.';
NoneDescText =
'Установщик оставит всё как есть.';
function BackupCheck_1(): Boolean;
var
BackupDescLabel, DeleteDescLabel, MoveDescLabel, Move2DescLabel, NoneDescLabel: TLabel;
begin
BackupPage:=CreateCustomPage(wpWelcome, 'Создание резервных копий файлов перед установкой', 'Пожалуйста, прочтите следующую важную информацию перед тем, как продолжить.');
BackupDescLabel:=TLabel.Create(WizardForm);
BackupDescLabel.Parent:=BackupPage.Surface;
BackupDescLabel.Left:=0;
BackupDescLabel.Top:=0;
BackupDescLabel.Width:=BackupPage.SurfaceWidth;
BackupDescLabel.Height:=80;
BackupDescLabel.AutoSize:=False;
BackupDescLabel.Wordwrap:=True;
BackupDescLabel.Caption:=BackupDescText;
DeleteRadioButton:=TNewRadioButton.Create(WizardForm);
DeleteRadioButton.Parent:=BackupPage.Surface;
DeleteRadioButton.Checked:=False;
DeleteRadioButton.Top:=85;
DeleteRadioButton.Width:=BackupPage.SurfaceWidth;
DeleteRadioButton.Font.Style:=[fsBold];
DeleteRadioButton.Font.Size:=9;
DeleteRadioButton.Caption:='Удалить файлы'
DeleteDescLabel:=TLabel.Create(WizardForm);
DeleteDescLabel.Parent:=BackupPage.Surface;
DeleteDescLabel.Left:=18;
DeleteDescLabel.Top:=DeleteRadioButton.Top + DeleteRadioButton.Height + 4;
DeleteDescLabel.Width:=BackupPage.SurfaceWidth;
DeleteDescLabel.Height:=40;
DeleteDescLabel.AutoSize:=False;
DeleteDescLabel.Wordwrap:=True;
DeleteDescLabel.Caption:=DeleteDescText;
MoveRadioButton:=TNewRadioButton.Create(WizardForm);
MoveRadioButton.Parent:=BackupPage.Surface;
MoveRadioButton.Checked:=False;
MoveRadioButton.Top:=125;
MoveRadioButton.Width:=BackupPage.SurfaceWidth;
MoveRadioButton.Font.Style:=[fsBold];
MoveRadioButton.Font.Size:=9;
MoveRadioButton.Caption:='Сделать резервную копию файлов'
MoveDescLabel:=TLabel.Create(WizardForm);
MoveDescLabel.Parent:=BackupPage.Surface;
MoveDescLabel.Left:=18;
MoveDescLabel.Top:=MoveRadioButton.Top + MoveRadioButton.Height + 4;
MoveDescLabel.Width:=BackupPage.SurfaceWidth;
MoveDescLabel.Height:=40;
MoveDescLabel.AutoSize:=False;
MoveDescLabel.Wordwrap:=True;
MoveDescLabel.Caption:=MoveDescText;
Move2RadioButton:=TNewRadioButton.Create(WizardForm);
Move2RadioButton.Parent:=BackupPage.Surface;
Move2RadioButton.Checked:=True;
Move2RadioButton.Top:=165;
Move2RadioButton.Width:=BackupPage.SurfaceWidth;
Move2RadioButton.Font.Style:=[fsBold];
Move2RadioButton.Font.Size:=9;
Move2RadioButton.Caption:='Обновить существующие файлы'
Move2DescLabel:=TLabel.Create(WizardForm);
Move2DescLabel.Parent:=BackupPage.Surface;
Move2DescLabel.Left:=18;
Move2DescLabel.Top:=Move2RadioButton.Top + Move2RadioButton.Height + 4;
Move2DescLabel.Width:=BackupPage.SurfaceWidth;
Move2DescLabel.Height:=40;
Move2DescLabel.AutoSize:=False;
Move2DescLabel.Wordwrap:=True;
Move2DescLabel.Caption:=Move2DescText;
NoneRadioButton:=TNewRadioButton.Create(WizardForm);
NoneRadioButton.Parent:=BackupPage.Surface;
NoneRadioButton.Checked:=False;
NoneRadioButton.Top:=205;
NoneRadioButton.Width:=BackupPage.SurfaceWidth;
NoneRadioButton.Font.Style:=[fsBold];
NoneRadioButton.Font.Size:=9;
NoneRadioButton.Caption:='Ничего не трогать'
NoneDescLabel:=TLabel.Create(WizardForm);
NoneDescLabel.Parent:=BackupPage.Surface;
NoneDescLabel.Left:=18;
NoneDescLabel.Top:=NoneRadioButton.Top + NoneRadioButton.Height + 4;
NoneDescLabel.Width:=BackupPage.SurfaceWidth;
NoneDescLabel.Height:=40;
NoneDescLabel.AutoSize:=False;
NoneDescLabel.Wordwrap:=True;
NoneDescLabel.Caption:=NoneDescText;
end;
function BackupCheck_2(): Boolean;
begin
If DeleteRadioButton.Checked then
begin
DelTree(ExpandConstant('{app}\res_mods\{#ModVer}'), True, True, True);
DelTree(ExpandConstant('{app}\res_mods\xvm'), True, True, True);
CreateDir(ExpandConstant('{app}\res_mods\{#ModVer}'));
end;
end;
function BackupCheck_3(): Boolean;
begin
If MoveRadioButton.Checked then
begin
MoveDir(ExpandConstant('{app}\res_mods\{#ModVer}\'),ExpandConstant('{app}\res_mods\backup\{#ModVer}' ));
MoveDir(ExpandConstant('{app}\res_mods\xvm\'),ExpandConstant('{app}\res_mods\backup\xvm'));
CreateDir(ExpandConstant('{app}\res_mods\{#ModVer}'));
DelTree(ExpandConstant('{app}\res_mods\xvm'), True, True, True);
end;
end;
function BackupCheck_4(): Boolean;
var
srcFile, destFile: string;
basePath, shortPath: string;
begin
If Move2RadioButton.Checked then
begin
basePath := ExpandConstant('{app}\res_mods');
srcFile := ExpandConstant(CurrentFileName);
shortPath := srcFile;
StringChangeEx(shortPath, basePath, '', True);
destFile := ExpandConstant('{app}\res_mods\Backup') + shortPath;
ForceDirectories(ExtractFilePath(destFile));
MoveFile(PChar(srcFile), PChar(destFile));
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep=ssInstall then
begin
BackupCheck_2();
BackupCheck_3();
BackupCheck_4();
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
CopyDir(ExpandConstant('{app}\res_mods\Backup\'),ExpandConstant('{app}\res_mods'));
DelTree(ExpandConstant('{app}\res_mods\Backup'), True, True, True);
end;
end;
|
|
Отправлено: 10:40, 09-12-2014
| #2098
|