Old 5th November 2008, 22:15   #1
Pocketfox
Junior Member
 
Join Date: Nov 2008
Posts: 1
Removing directory upon installation with new installer

Hey all.
I've searched everywhere, went the trial and error route, and still no luck. Here's what I'm trying to do:

I have an application that saves user data to the common application data folder (C:\Documents and Settings\All Users\Application Data\My company\my application). The uninstaller I created for this app does not remove this application data folder...no biggie. However, I have an update to this application, and I would like it to remove the user's application data folder during the installation as to avoid conflict with my updated application.

I've tried placing delete variables in every section, creating new callback functions, and nothing. Please note, I'm a fairly novice user, and any help will be greatly appreciated.
Thanks for reading
Pocketfox is offline   Reply With Quote
Old 7th November 2008, 22:31   #2
AaronLS
Senior Member
 
Join Date: Mar 2008
Posts: 129
Have you tried:

RMDir /r 'C:\Documents and Settings\All Users\Application Data\My company\my application'

This will delete the directory and all contents, so be careful.

"Note that the current working directory can not be deleted. The current working directory is set by SetOutPath."

See additional notes on this in the users manual.

So you might need to do something like:
SetOutPath 'C:\someotherexistingdirectory'
RMDir /r 'C:\Documents and Settings\All Users\Application Data\My company\my application'

This is untested code, I think you might need to use double back slashes or forward slashes. Beucase the \ might be treated liek an escape sequence.

Edit: Also note that deleting things from All Users might require administrative priviliages.

You can add the /REBOOTOK flag to allow the delete to occur after the computer reboots. This is useful if the user has that folder open which might prevent the deletion, or if a file in the folder is opened/locked by some app.
AaronLS 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