Skip to content
⌘ NSIS Forum Archive

Cancel button click not deleting the installation folder

3 posts

DivyaArun#

Cancel button click not deleting the installation folder

Hi,

I have a custom cancel function which should delete all the files copied in installation folder. In my case, all the files are not copied in the "Install" section. Instead I have some custom pages which copies few files in each pages according to our requirement . My requirement is whenever I click "Cancel" button from any pages, it should delete all the files and folder copied till that point. Though the files are deleted, not the parent folder. I am not able to figure out the reason. Please suggest

Function OnUserAbort
MessageBox MB_YESNO "Do you want to abort the installation?" IDYES NoCancelAbort

; Delete the installation folder.
Abort ; causes installer to not quit.
NoCancelAbort:
!insertmacro stopAndUninstallService "Service"

; Delete the installation folder.
SetOutPath $INSTDIR
RMDIR /r $INSTDIR
RMDIR $INSTDIR

FunctionEnd
DivyaArun#
Originally Posted by Anders View Post
"SetOutPath $INSTDIR" keeps a lock on the folder, do "SetOutPath $WinDir" before RMDir.
It worked. Thanks