Jump to content

Uninstall question?


*Reaper*

Recommended Posts

Ok....

I'm working on a addon that saves its settings and such in

C:\Documents and Settings\Reapers\Application Data\Program Name\

Question I have is when creating a uninstallable addon, how would I

make the addon uninstall that particular part.....

Because not everyone has C:\ as their main drive, and of course there username

would be different also.......

Any help would be appreciated...

Link to comment
Share on other sites

OK pretty easy, in your [uninstall] section in the DelFiles directive you add a new section name (anything) example

[Uninstall]
DelFiles=Example.Other.Sections,New.Section;<-Add it here

Now create it and under the [New.Section] you add a list of those files you want deleted (the one that the program creates)

[New.Section]
Filename1.ini
Filename2.bak
etc...

Now you have to add the New.Section=LDID(,SubDir) to [DestinationDirs] so the INF will know where the files are, so go so look for the LDID of the %UserProfile%\Application Data

Here is the LDID (number) for that folder

16410 %userprofile%\Application Data

So it will go like this

[DestinationDirs]
Example.Section=16422,"Program Name"
New.Section =16410,"Program Name";<-This is the DelFiles destination dir

The folder where all the old filenames exist must be defined in a DestinationDirs section as shown in the

above example.

Post your INF when you think you are done maybe we can have a look at it

Link to comment
Share on other sites

Ok.....

This brings up another question....

The program creates the config file in the directory like I said before.....

BUT.....

The file is named like this....

Reapers.cfg

So it names the config file after the username that is being used.....

So how would you allow for this....?

Link to comment
Share on other sites

OK in your uninstall section try something like this (this will delete all the files not matter what they are in a directory)

[Uninstall]
RunPostSetupCommands=RunPostSetup.SectionName ;<- You can name this whatever you want

[RunPostSetup.SectionName]
RUNDLL32 advpack.dll,DelNodeRunDLL32 %16410%\%Program Name%,8

You can change the flag (8) to do different things

1  // delete the directory only if it's empty
2 // don't delete any sub-dirs; delete only the files
4 // don't delete the dir itself
8 // delete UNC [network] paths ;This deletes both the files, sub dirs and the folder itself

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...