Old 28th February 2007, 06:40   #1
dilbertz
Junior Member
 
Join Date: Feb 2007
Posts: 5
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
dilbertz is offline   Reply With Quote
Old 28th February 2007, 06:52   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2007, 07:09   #3
dilbertz
Junior Member
 
Join Date: Feb 2007
Posts: 5
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
dilbertz is offline   Reply With Quote
Old 28th February 2007, 07:13   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
no i'd never suggest RMDir /r
all files deleted and remains $INSTDIR empty?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2007, 07:18   #5
dilbertz
Junior Member
 
Join Date: Feb 2007
Posts: 5
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
dilbertz is offline   Reply With Quote
Old 28th February 2007, 08:46   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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?

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 28th February 2007, 10:35   #7
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
This happen if dir is 'working' for instaler (or other program). Add SetOutPath "$WINDIR" before folder deletion.
Takhir 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