howeven
howeven

Reputation: 11

InnoSetup Uninstallable=no results in orphaned directory

I'm having difficulties with a "parent" Inno Setup installer creating and leaving behind an orphaned directory when its "child" applications have all been uninstalled. Below is an example of the parent installer code I am using, I have left out unimportant details.

Parent installer is configured as:

[Setup]
Uninstallable=no
CreateUninstallRegKey=no
DefaultDirName={pf32}\{#MyAppPublisher}

[Dirs]
;This section is empty

[Files]
Source: "SetupA-1.00"; DestDir: "{tmp}"; DestName: "setupa.exe"; Flags: deleteafterinstall; Tasks: "installA"
Source: "SetupB-2.00"; DestDir: "{tmp}"; DestName: "setupb.exe"; Flags: deleteafterinstall; Tasks: "installB"

[Run]
Filename: "{tmp}\setupA.exe"; Parameters: "/SILENT"; Tasks: "installA"
Filename: "{tmp}\setupB.exe"; Parameters: "/SILENT"; Tasks: "installB"

Now, I suspect that the DefaultDirName is the problem, but it should also be noted how the child applications install:

[Setup]
Uninstallable=yes
DefaultDirName={pf32}\{#MyAppPublisher}\{#MyAppName}

So the use case is that the parent (perhaps bootstrapper is a better name) installer is run, the user selects the application(s) they wish to install and then those apps are installed into Program Files \ Pub \ AppName. Uninstallation of those applications is a manual 1 by 1 process, there is not going to be a "parent uninstaller". When all child applications have been uninstalled the Program Files \ Pub directory is always left, orphaned and empty. Because the parent installer was configured as Uninstallable=no, there is no way to remove this directory other than by hand. Unfortunately DefaultDirName is required in all Inno scripts, but there must be some way to suppress its creation.

I have considered adding a Program Files \ Pub uninstall check to the child installers, so that if the entire publisher directory is empty then it can be removed, but that is more trouble than it is worth. Any ideas?

Upvotes: 1

Views: 586

Answers (2)

tsereg
tsereg

Reputation: 1

CreateAppDir directive should be set to 'no' to suppress creation of the application directory. Besides Uninstallable, other usefull directives are CreateUninstallRegKey and UpdateUninstallLogAppName.

Upvotes: 0

howeven
howeven

Reputation: 11

Figured I'd follow-up in the event someone else comes across this problem.

I have configured the parent installer to use our common application data folder for the DefaultDirName, this way that when it is uninstalled there's no real harm in leaving behind the possibly empty directory. Not perfect, but it meets our requirements.

Upvotes: 0

Related Questions