user5081802
user5081802

Reputation:

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.

Upvotes: 1

Views: 551

Answers (2)

user5081802
user5081802

Reputation:

Ah Finally I have solve it myself and find the error reason.OH that was a headache, I was just stuck. I just need to remove true;

Here is the full code:

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

Now it is fully working.

THANKS EVERYONE FOR YOUR HELPS.

Upvotes: 0

Ophir Yoktan
Ophir Yoktan

Reputation: 8449

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.

Upvotes: 1

Related Questions