[wix-users] Using RegistrySearch, with Directory/File search to get Directory issue

Lewis Henderson henderso at opentext.com
Tue Apr 5 11:58:15 PDT 2016


Hi Tim,

Try splitting out your RegistrySearch and DirectorySearch into two (non-nested) Property elements.  Have the RegistrySearch set GS_PATH and the DirectorySearch set GS_EXISTS.  Then GS_PATH contains only the path you want and GS_EXISTS will only be set if the file is there.  (Of course, use [GS_PATH] in the DirectorySearch Path, and remove the AssignToProperty attribute.)

				Lewis

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Tim Mayert
Sent: Tuesday, April 5, 2016 2:51 PM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Using RegistrySearch, with Directory/File search to get Directory issue

Hello,

I am trying to get and set a Directory property if the directory exists with a specific file. I am using the following code:
<Property Id="GS_EXISTS" Secure="no">
       <RegistrySearch Id="GS_Path_Key" Root="HKLM" Key="Software\SMART Technologies\Gallery\Install Information" Name="Install Path" Type="raw">
              <DirectorySearch Id="GS_Search" Path="[GS_EXISTS]" Depth="1" AssignToProperty="no">
                     <FileSearch Id="GS.exe" Name="Gallery Setup.exe" MinVersion="1.0.1.0" />
              </DirectorySearch>
       </RegistrySearch>
</Property>

This will find the directory and file, but it will set my GS_EXISTS property to the full path and file name. I only want the path if the file exists. I saw the AssignToProperty element and the way I read it was that it would not update the original RegistrySearch property with path/file name if set to "no". So I thought that this would create the property with only the RegistrySearch value if the Directory/File search was true, but again it used the full path/file name.

So how can I do a search of the registry to get the path name and validate that a file exists without having the property updated to be full path and file name?

Thanks,

Tim Mayert.

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list