Backtassaar
14th July 2008 19:46 UTC
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:
Section /o "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.
Anders
14th July 2008 20:19 UTC
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
Backtassaar
29th July 2008 10:27 UTC
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
Anders
29th July 2008 12:48 UTC
just having the path on the stack or in a variable will not stop you from deleting
MidnightJava
2nd November 2008 04:29 UTC
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.
Afrow UK
2nd November 2008 13:48 UTC
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