1
votes


During the install , I add folder with files:
Source: {#DBPath}; DestDir: "{app}\DataBase";
I want that in the Uninstall, inno-setup will ask the user if
To delete the files or not.

How can I do that ?
Thanks, Avi.

1

1 Answers

5
votes

If u want to keep a folder then u should add uninsneveruninstall flag to instruct inno-setup not to delete this folder during uninstallation.Then you can conditionally remove this folder with Pascal script

Here is how to do this :

[Files]
Source: {#DBPath}; DestDir: {app}\DataBase; Flags: uninsneveruninstall

[Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then
  begin
    if MsgBox('Do You Want To Delete DataBase Folder?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
    //this is the msg that will display after uninstall,change is as you prefer 
    begin
        DelTree(ExpandConstant('{app}\DataBase'), True, True, True);
    end;
  end;
end;