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?
If you only have to wait for the user's choice to verify that directory, then DirectorySearch won't do the job for you. You'll have to author a "set property" custom action right after the user chooses INSTALLDIR, for instance, on a Next click of InstallDirDlg.
UPDATE. So, I mean basically the following:
session["DIRECTORY_PATH"] = session[INSTALLDIR] + "\MyDirectory";
NOT DIRECTORY_PATH
)Hope it makes it clearer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With