How do you find the user-selected install path in

2019-01-26 13:02发布

问题:

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?

回答1:

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.