【发布时间】:2014-08-18 16:53:05
【问题描述】:
如何使用在附加任务面板中点击下一步按钮时必须执行的任务功能删除文件夹?
非常感谢。
【问题讨论】:
-
[InstallDelete]是第一个处理的部分。当他们单击“下一步”或仅在安装的第一阶段是否真的需要删除它?在设置开始之前进行任何更改通常是一个坏主意。
标签: inno-setup
如何使用在附加任务面板中点击下一步按钮时必须执行的任务功能删除文件夹?
非常感谢。
【问题讨论】:
[InstallDelete] 是第一个处理的部分。当他们单击“下一步”或仅在安装的第一阶段是否真的需要删除它?在设置开始之前进行任何更改通常是一个坏主意。
标签: inno-setup
要检查是否选择了某个任务,您可以使用IsTaskSelected 函数。因此,为了满足您的要求,您可以编写如下内容:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Tasks]
Name: deletefolder; Description: "Delete a folder"; GroupDescription: "Group Description:"
[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
// allow the setup turning to the next page
Result := True;
// if we are on the Additional Tasks page and the task is selected, then...
if (CurPageID = wpSelectTasks) and IsTaskSelected('deletefolder') then
// here call the RemoveDir or DelTree function depending on your needs
end;
【讨论】:
ExpandConstant,DelTree(ExpandConstant('{app}\test*')) 应该更好;-)