Old 31st March 2006, 16:09   #1
coco_vc
Senior Member
 
Join Date: Jan 2006
Location: Germany
Posts: 138
Uninstall section - removing files

Hi *,

I used some wizards to generate a basic installer that just copies 3 files on the destination computer. I noticed that in the uninstall section is:
code:

Delete "$INSTDIR\sample1.exe"
Delete "$INSTDIR\sample2.exe"
Delete "$INSTDIR\sample3.exe"



Why would I need something like this (3 times the Delete command) and not having in the uninstall section just:
code:

RMDir /REBOOTOK "$INSTDIR"



Otherwise if I have 20 files that I need to copy when install, and to remove when uninstall, I would need 20 times the File command and 20 times the Delete command, for the same files, instead of 1 RMDir only in uninstall case. Or am I totally wrong/missing smth here?

Thanks,
Viv
coco_vc is offline   Reply With Quote
Old 31st March 2006, 16:46   #2
bhaelochon
Junior Member
 
Join Date: Nov 2005
Location: Kansas City, MO, USA
Posts: 35
Send a message via ICQ to bhaelochon Send a message via AIM to bhaelochon Send a message via Yahoo to bhaelochon
RMDir /r /REBOOTOK $INSTIDR

"Never hold your farts in. They travel up your spine and into your brain, and that's where you get shitty ideas from." - Unknown
bhaelochon is offline   Reply With Quote
Old 31st March 2006, 16:57   #3
rsegal
Senior Member
 
rsegal's Avatar
 
Join Date: Feb 2003
Location: Toronto, Canada
Posts: 227
Re: Uninstall section - removing files

Quote:
Originally posted by coco_vc

Otherwise if I have 20 files that I need to copy when install, and to remove when uninstall, I would need 20 times the File command and 20 times the Delete command, for the same files, instead of 1 RMDir only in uninstall case. Or am I totally wrong/missing smth here?

Thanks,
Viv
You could do either way but you may want to consider where people are installing these files/folders from your install package. If someone installs their files to their My Documents folder and you tell the uninstaller to delete the entire folder that user has just had their My Documents folder deleted. Don't laugh. It's happened to me. Most users are likely to install files to a unique folder name that will not conflict with any other files/folders on their computer and you are likely to have a pre populated folder name for where your files are to be installed.

Alternatively as has been mentioned many times on these forums you can keep track of what files are installed during installation and then uninstall only those files by reading that file. This has the nice advantage that you can install to potentially dangerous spots such as My Documents or even the Windows\System folder and uninstall and you'll have no issues on uninstallation.
rsegal is offline   Reply With Quote
Old 31st March 2006, 18:38   #4
dienjd
Senior Member
 
Join Date: Oct 2005
Posts: 189
Agreed, using "RMDir /r $INSTDIR" is irresponsible unless you know what $INSTDIR is. People do odd things when installing, and nobody wants to be responsible for wiping a user's $WINDIR, $PROGRAMFILES, $APPDATA, etc. when they uninstall.
dienjd is offline   Reply With Quote
Old 3rd April 2006, 12:51   #5
coco_vc
Senior Member
 
Join Date: Jan 2006
Location: Germany
Posts: 138
Thx for all your answers. So your suggestion would be to:
- delete specifically each file I installed
- delete, maybe over reboot, the INSTDIR, without using the /r flag

So, it will look like:
code:

Delete /REBOOTOK "$INSTDIR\sample1.exe"
Delete /REBOOTOK "$INSTDIR\sample2.exe"
Delete /REBOOTOK "$INSTDIR\sample3.exe"
RMDir /REBOOTOK "$INSTDIR"



This would be both: save and nice.

Questions:
1) Is the above correct?
2) Is there a way to specify only once all the files that need to be installed and removed (it's the same list, so would be nice to have somehow a list of all files and on install specify to install all and on uninstall to remove all)

Thx,
Viv
coco_vc is offline   Reply With Quote
Old 3rd April 2006, 15:41   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
To delete only installed files, use:
http://nsis.sourceforge.net/Uninstal...nstalled_files
This is probably not needed here though; you might as well just delete them yourself with the code that you have posted (which is perfect).

-Stu
Afrow UK is offline   Reply With Quote
Old 3rd April 2006, 16:18   #7
coco_vc
Senior Member
 
Join Date: Jan 2006
Location: Germany
Posts: 138
Thx Stu. I used in the end the:

code:

Delete /REBOOTOK "$INSTDIR\sample1.exe"
Delete /REBOOTOK "$INSTDIR\sample2.exe"
Delete /REBOOTOK "$INSTDIR\sample3.exe"
RMDir /REBOOTOK "$INSTDIR"



Viv
coco_vc 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