开发者

Can't delete the folder created in My Documents with Inno Setup

开发者 https://www.devze.com 2023-02-07 19:46 出处:网络
I have tried to use the program described here Problems in deleting a Folder during the unin开发者_高级运维stalation with Inno Setup

I have tried to use the program described here Problems in deleting a Folder during the unin开发者_高级运维stalation with Inno Setup

after the answers were posted but for some unknown reason to me that code part isn't doing anything. May be related to windows version or if it's on 32 or 64 bit?

Here's the code used by me:

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
mres : integer;
begin
 case CurUninstallStep of
 usPostUninstall:
 begin
mres := MsgBox('Do you want to delete saved games?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
 if mres = IDYES then
   DelTree('ExpandConstant({userdocs}\SpellForce2)', True, True, True);
    end;  
  end;
end;

Any idea that could be useful to me?

Thanks in advance! :)


You are trying to delete a folder named 'ExpandConstant({userdocs}\SpellForce2)' (literally), just remove the ' character to the ExpandConstant call (it is a call to a sub-routine).

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
  mres : integer;
begin
  case CurUninstallStep of
    usPostUninstall:
      begin
        mres := MsgBox('Do you want to delete saved games?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
        if mres = IDYES then
          DelTree(ExpandConstant('{userdocs}\SpellForce2'), True, True, True);
      end;  
  end;
end;


You cannot do

DelTree('ExpandConstant({userdocs}\SpellForce2)', True, True, True);

Of course, this should read

DelTree(ExpandConstant('{userdocs}\SpellForce2'), True, True, True);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号