Inno Setup: Conditionally delete non-empty directo

2019-04-18 01:03发布

I am creating the installer for my Windows application via Inno Setup. The application itself writes some configuration data to the user home folder, into its own sub-directory.

Now during uninstallation I want to allow the user to select an option to delete that folder as well (which originally has not been created by Inno Setup, but by the application).

What would be the best way to achieve that in Inno Setup?

标签: inno-setup
1条回答
何必那么认真
2楼-- · 2019-04-18 01:06

There's no explicit support for this in Inno Setup. But you can code it in pascal script using CurUninstallStepChanged event function:

[Code]

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    if MsgBox('Do you want to delete?', mbConfirmation, MB_YESNO) = idYes then
    begin
      DelTree(ExpandConstant('{app}\Folder'), True, True, True);
    end;
  end;
end;
查看更多
登录 后发表回答