在 Inno Setup Uninstaller 中删除用户在安装时指定的文件夹

Remove folder specified by user at install time in Inno Setup Uninstaller

我有一个设置脚本,它允许用户指定一个相对路径,应用程序将在其中保存一些文件和文件夹。该路径将保存到 config.ini 文件中。到那时一切都按预期工作。

现在我希望卸载程序执行删除指定路径下的所有内容。在我的安装程序脚本中,我有一个变量

var DataPath : String;

持有路径。

为了执行删除,我在我的脚本中添加了以下代码行 (as mentioned on their website):

[UninstallDelete]
Type: filesandordirs; Name: DataPath

不幸的是,这不起作用。有人知道怎么做吗?

我的 [INI] 部分如下所示:

[INI]
Filename: "{app}\config.ini"; Section: "connection = standard"; \
    Key: datapath; String: {code:GetDataPath}

[UninstallDelete] 中使用 {code:GetDataPath},与在 [INI] 部分中使用相同:

[UninstallDelete]
Type: filesandordirs; Name: {code:GetDataPath}