Old 14th July 2008, 18:46   #1
Backtassaar
Junior Member
 
Join Date: Jul 2008
Location: Prag
Posts: 2
Send a message via ICQ to Backtassaar
Angry RMDir unfunctional

Hi everybody, I have a problem which many people here has been solving, but even after reading through lots of topics i didnt find my answer. I have this section:

PHP Code:
Section /"un.$(NAME_SecUnRemoveAllFiles)" SecUnRemoveAllFiles
    SetOutPath 
"C:\"
    MessageBox MB_ICONQUESTION|MB_YESNO $(MB_REMOVE_ALL_FILES) IDNO skip_removeall
        RMDir /r "
$INSTDIR"
    skip_removeall:
SectionEnd 
This Section is my last section in uninstaller and i have set OutPath to C:\ , but still, my folder is not deleted (only folder remains, all files inside are deleted). I looked on that uninstaller through Process Manager and it told me that process "Au_.exe" is still holding my $INSTDIR and so it cannot be deleted, but that was the unistaller process. So i pop-upped a message window with all variables i was using and it showed me that my InstDir is hold only by $INSTDIR.
Now i have no idea what to do more. It looks like a bug in RMDir to me, because in official Scripting Reference is told that only $OUTDIR can block directory from being removed. And i dont want to delete it by some !system commands. Can you help me? Thanks a lot for every response.
Backtassaar is offline   Reply With Quote
Old 14th July 2008, 19:19   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
first off, doing SetOutPath "c:\" might not be the best thing to do, the user might not have a c: drive, do SetOutPath with $temp or $desktop

You might have a plugin or something like that with a handle open to $instdir, or if $instdir contains a COM dll or something that could be loaded in some other process.

To get around all of this, add the reboot flag to rmdir

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2008, 09:27   #3
Backtassaar
Junior Member
 
Join Date: Jul 2008
Location: Prag
Posts: 2
Send a message via ICQ to Backtassaar
Well, i searched through my plugins - none of them is holding that path (I even tried to disable all of them - didnt help). Then i showed to myself a message window with all system registers during the uninstallation ($0, $1 .. $9, $R0 .. $R9). Not a single one has been holding way to that directory. There is a possibility that somewhere inside my program is that path pushed into stack. Is there a possibility that stack is blocking it? Or do you have any ideas what else could still hold that handle? Thanks a lot!
Backtassaar
Backtassaar is offline   Reply With Quote
Old 29th July 2008, 11:48   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
just having the path on the stack or in a variable will not stop you from deleting

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd November 2008, 03:29   #5
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
In case you're still looking for a solution to this: I had the same problem, and I couldn't find any reason the empty folder could not be deleted by RmDir. After trying many things, I moved the RmDir statement to the very end of the -un.post section, so it's the very last command that executes; and that fixed it.

The only statements I had between the previous and final locations of the RmDir statement were statements deleting registry values and shortcuts. My best guess is the problem was caused by having a QuickLaunch shortcut pointing to a location that used to be inside the now-empty directory I was trying to delete. Perhaps that's what was holding on to the handle for the empty directory.

-Mark
MidnightJava is offline   Reply With Quote
Old 2nd November 2008, 12:48   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Just a note for you people using RMDir /r on $INSTDIR (which is potentially very harmful to a user's computer).
http://nsis.sourceforge.net/Validating_$INSTDIR_before_uninstall

Stu
Afrow UK 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