Search code examples
inno-setuppascalscript

Removedir function is not working


I am new to inno setup so please forgive any ignorance. I am trying to delete a folder only if it's empty Here is the script:

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usPostUninstall then
  begin
    RemoveDir(ExpandConstant('{userdocs}\Games'), True, True, True);
  end;
end;

This reruns an error:

Invalid number of parameter.

I got (not the full code but some pieces) this from this site. I have another question,does RemoveDir function check if the folder is empty or not? I already read the documentation. Please help.Thanks.


Solution

  • According to the docs the function gets only a single parameter:

    Prototype:

    function RemoveDir(const Dir: string): Boolean;
    

    Description: Deletes an existing empty directory. The return value is True if a new directory was successfully deleted, or False if an error occurred.