1. 程式人生 > >innosetup解除安裝刪除檔案

innosetup解除安裝刪除檔案

需求背景:

innosetup原則上是安裝哪些檔案就解除安裝那些檔案。

但實際上往往會在應用的使用過程中,會生成一些日誌檔案。在解除安裝的時候,不能刪掉,會提示手動清理。

這樣還是挺影響體驗的。

解決方法:

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
    if CurUninstallStep = usDone then
    begin
 
     //刪除 {app} 資料夾及其中所有檔案
    DelTree(ExpandConstant('{app}'), True, True, True);
    end;
end;