需求
Inno Setup 原则上是安装哪些文件就卸载那些文件。
但实际上往往会在应用的使用过程中,会生成一些日志文件或者在更新程序进行文件操作的时候,产生的文件,在卸载的时候,不能删掉,直接保留在原处,或会提示手动清理。这样还是挺影响用户体验的。
解决方法:
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usDone then
begin
//删除 {app} 文件夹及其中所有文件
DelTree(ExpandConstant('{app}'), True, True, True);
end;
end;
或
[UninstallDelete]
;删除可能产生的日志文件或图片缩略图缓存文件
Type: files; Name: "{app}\log.txt";
Type: files; Name: "{app}\Thumbs.db";
Type: files; Name: "{app}\update\*.exe";
Type: files; Name: "{app}\update\*.xml";
Type: files; Name: "{app}\update\*.sys";
Type: files; Name: "{app}\update\*.dll";
Type: files; Name: "{app}\update\*.cab";
Type: files; Name: "{app}\update\*.jsp";
Type: dirifempty; Name: "{app}\update";
Inno Setup 中文帮助文档
https://download.csdn.net/download/qq_36190858/10836946