9

I need to get the path that the user chose to install my application into.

If I set CreateAppDir=yes and set a DefaultDirName=C:\MyApp\ the user can change it to some other directory. After they do this, I need to know which directory they chose on the next install wizard step. How can I get this value?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
RichC
  • 7,829
  • 21
  • 85
  • 149

1 Answers1

14

Use the {app} constant. The reference describes it as:

The application directory, which the user selects on the Select Destination Location page of the wizard. For example: If you used {app}\MYPROG.EXE on an entry and the user selected "C:\MYPROG" as the application directory, Setup will translate it to "C:\MYPROG\MYPROG.EXE".

Optionally you can use the WizardDirValue function. This one is described as:

Returns the current contents of the edit control on the Select Destination Location page of the wizard.

Unlike ExpandConstant('{app}'), this function will not fail if called after the wizard is shown but prior to the user selecting a directory. Rather, it will return the default directory name.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
TLama
  • 75,147
  • 17
  • 214
  • 392
  • Ahhh - I think {app} is what I need. I looked at that previously and I guess I read it differently because it didn't seem like what I wanted. Thanks! – RichC Feb 05 '15 at 16:37
  • And UUUGG - I just realized I use it all over the place and it didn't even dawn on me that's what it was doing. DOH! :P – RichC Feb 05 '15 at 16:39