I always install a program (B
= {app}
) inside of the C:\A
(C:\A\B
). I need to know how to use the DelTree
function to delete B
folder and A
folder (the A
folder only if is empty).
This is my code to delete B folder:
DelTree(ExpandConstant('{app}'), True, True, True);
I need this to rollback an installation of prerequisities, when the installation fails or is cancelled. So I cannot use UninstallDelete
or InstallDelete
sections.
Just use RemoveDir
and ignore errors.
Deletes an existing empty directory. The return value is True if a new directory was successfully deleted, or False if an error occurred.
Use ExtractFileDir
to resolve a path to the parent folder of the {app}
.
RemoveDir(ExtractFileDir(ExpandConstant('{app}')));