Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Аватара для Johny777

Ветеран


Сообщения: 649
Благодарности: 444

Профиль | Отправить PM | Цитировать


tr011_tmn, удаление самого каталога вместе с содержимым подойдёт?

читать дальше »
Код: Выделить весь код
const
    FOLDER_NAME = 'Redist';

var
    DeleteRedistCheckBox: TCheckBox;

// Force - Boolean value that is true if folders with the read-only attribute set are to be deleted; false (default) if they are not.
procedure DeleteFolder(const FolderPath: String; const Force: Boolean);
var
    oFS: Variant;
begin
    if not DirExists(FolderPath) then Exit;
    oFS := CreateOleObject('Scripting.FileSystemObject');
    try
        oFS.DeleteFolder(RemoveBackslash(FolderPath), Force);
    except
        ShowExceptionMessage();
    end;
end;


procedure CurStepChanged(CurStep: TSetupStep);
begin
    if CurStep = ssPostInstall then
      if DeleteRedistCheckBox.Checked then DeleteFolder(AddBackslash(ExpandConstant('{app}')) + FOLDER_NAME, True);
      // или DelTree(AddBackslash(ExpandConstant('{app}')) + FOLDER_NAME, True, True, True);
end;


procedure InitializeWizard();
begin
    DeleteRedistCheckBox := TCheckBox.Create(WizardForm.InstallingPage);
    with DeleteRedistCheckBox do
    begin
        Parent := WizardForm.InstallingPage;
        SetBounds(ScaleX(100), ScaleY(100), ScaleX(100), ScaleY(16));
        Caption := 'Delete Redist Folder';
    end;
end;

Последний раз редактировалось Johny777, 14-08-2013 в 15:21.

Это сообщение посчитали полезным следующие участники:

Отправлено: 15:02, 14-08-2013 | #1011