I would like to detect if a directory already exists in a custom installation location selected by the user in the GUI. I tried the following:
<Property Id="DIRECTORY_PATH">
<DirectorySearch Id="DirectorySearch" Path="[INSTALLDIR]\MyDirectory" />
</Property>
But this doesn't work because the DirectorySearch is happening during AppSearch. While INSTALLDIR is set later during InstallDirDlg. Since INSTALLDIR is not set in time for AppSearch, DIRECTORY_PATH is incorrectly set to "\MyDirectory".
I tried to change when AppSearch happens with InstallUISequence and InstallExecuteSequence, but it will only let AppSearch come before CostInitialize, no later.
So how do I do a directory search at the user selected INSTALLDIR location?