Archive: removing the installed folder when uninstalling


removing the installed folder when uninstalling
Greetings
I'm trying to fight with the problem of removeing the installed folder where I placed uninstall.exe.
I thought of uninstalling from a higher folder than the installed.
In order to do that I wrote a small function:

Function un.OnInit

${un.GetParent} "$INSTDIR" $R0
CpyStr $INSTDIR $R0
MessageBox MB_OK '"$OUTDIR" will be uninstalled from "$INSTDIR"'

FunctionEnd
and $INSTDIR is replaced by $OUTDIR throughout the Uninstall Section.
And it worked.

But if the MessageBox is neutralized, replaced by DetailPrint, moved to the Uninstall Section - it does not work.
Everything is uninstalled except the folder.
Why?
Thanks in advance
Dilbertz


Just place the uninstaller into $INSTDIR, e.g.
WriteUninstaller "$INSTDIR\uninstall.exe"
don't forget to add at the end of uninstall section, after you've deleted all files/folders individual, the command RmDir "$INSTDIR".

Also, you may want to have a look at Advanced Uninstall Log,

http://nsis.sourceforge.net/Advanced...og_NSIS_Header


Thanks for your lightening fast answer.
Of course I did both
WriteInstaller $INSTDIR\Uninstaller.exe in the install section
and RMDir /r $INSTDIR in the Uninstall section
and it didn't work! i.e. everything was deleted except $INSTDIR itself
Unless you meant: in addition to RMDir /r $INSTDIR
the last line should be RMDir $INSTDIR
I'll try.
Thanks again.
Dilbertz


no i'd never suggest RMDir /r
all files deleted and remains $INSTDIR empty?


Sorry but I have subfolders in $INSTDIR and apart from registry handling that's all I do.
And you're right all files and subfolders deleted and I stayed with empty $INSTDIR but I haven't tried RMDir $INSTDIR yet. You're too fast, man.
Thanks


When all files/folders removed, adding RMDir "$INSTDIR" should remove parent if it's empty.
I'm going to do a guess, what about a hidden file e.g. help.GID which remains invisible?


This happen if dir is 'working' for instaler (or other program). Add SetOutPath "$WINDIR" before folder deletion.