0

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?

Matthias
  • 9,817
  • 14
  • 66
  • 125

1 Answers1

1

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;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • There is a problem with your code. It is being called during the installation already. But obviously I want to ask the user only during uninstallation. – Matthias Mar 05 '15 at 21:36
  • @Matthias Sorry, you are right. See my updated answer for an alternative implementation. – Martin Prikryl Mar 06 '15 at 07:05