Old 13th August 2019, 15:03   #1
DivyaArun
Junior Member
 
Join Date: Jul 2019
Posts: 30
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 is offline   Reply With Quote
Old 13th August 2019, 16:41   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
"SetOutPath $INSTDIR" keeps a lock on the folder, do "SetOutPath $WinDir" before RMDir.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th August 2019, 04:57   #3
DivyaArun
Junior Member
 
Join Date: Jul 2019
Posts: 30
Quote:
Originally Posted by Anders View Post
"SetOutPath $INSTDIR" keeps a lock on the folder, do "SetOutPath $WinDir" before RMDir.
It worked. Thanks
DivyaArun is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump