提问者:小点点

inno 安装程序询问用户是否卸载文件



在安装过程中,我添加了带有文件的文件夹:
来源:{#DBPath};德迪尔:“{app}\DataBase”;
我希望在卸载中,inno-set会询问用户是否
删除文件。

我该怎么做
谢谢,阿维。


共1个答案

匿名用户

如果你想保留一个文件夹,那么你应该添加< code > uninstneveruninstall 标志来指示inno-setup在卸载过程中不要删除这个文件夹。然后你可以用Pascal脚本有条件地删除这个文件夹

这是如何做到这一点:

[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;