Jump to content

This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

INSTALLDIR at Uninstall time.

1 reply to this topic

Scott Mayham

Scott Mayham
  • Full Members
  • 54 posts

Posted 13 March 2002 - 20:44

After a year of working with ISWI, I'm in the final stages of my first Installation using ISD7 (Basic MSI).  Now I've encountered the first problem I have not figured out how to solve.

The App I'm installing includes a "configurator" type program, which is to be launched via CustomAction at Install time (to set a bunch of stuff up), and at Uninstall time (to undo what it did at install time).  The configurator program is not streamed in the binary table or anything fancy like that.  It is simply deployed to one of the App's folders.

Everything is fine at Install time:  I fire the configurator using LaunchAppAndWait, in a deferred CustomAction conditioned on it's owning Feature being installed locally (&Featurename = 3).  It is sequenced in the Exec sequence just before InstallFinalize.  The CA's InstallScript uses the new "variable" INSTALLDIR and appends the remainder of the path to the configurator program to it thus:


The CA properly finds and runs the configurator, even if the customer (in the CustomSetup dialog) changes the installation folder for the Feature to something like D:\foo\bar.

The corresponding Uninstall CA is also Deferred, uses a similar script construction as above, is conditioned on the feature being removed (&Featurename = 2), and is sequenced in the Exec sequence right after InstallInitialize.  However, the Uninstall CA always tries to find the configurator program in the default path (e.g., Program Files\Manhattan Associates\MyApp\Configuration).  This ONLY works when the Feature is installed to the default location, which in practice is often not done.

I think I know part of why:  INSTALLDIR for the package is not really being changed by the CustomSetup dialog box; only some property related to the Feature's path is what get's changed.  Apparently, this is plopped into the InstallScript variable INSTALLDIR at installation time, so the the CA which runs at install time manages to find the configurator program just fine.  However, at uninstall time, this variable has reverted to the package's default INSTALLDIR value.  

My question then, is this:  if in the CustomSetup dialog box, the destination folder for the feature is changed, where is that path stored, so I can use it in a CA at uninstall time?

Many thanks,
T. Scott Mayham
Senior Software Engineer - Innovations
678 319 8384

Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 14 March 2002 - 10:22

Directories are ultimately related to components.  You can obtain the location of a given component in a number of ways.

After CostFinalize you can use the following in MsiFormatString (or directly in tables)
[#filekey] will return the path to any file.
[!filekey] will return the short name path (only works in registry table).
[$componentkey] will return the path to the components key file.

MsiLocateComponent can be used from a CA (or any other program at any time).  This may be useful within your configuration program.
Ian Blake
(Currently Unemployed)