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

Tim Mayert TimMayert at smarttech.com
Wed Apr 6 06:46:10 PDT 2016


Thanks Lewis.

Yes I ended up doing it this way and it does work, but still have to wonder why they have that AssignToProperty attribute if it always overwrites the original entry created by the RegistrySearch...

Anyways, I did not try this, but can we condition the 2nd DirectorySearch so that if the RegistrySearch did not find the path that the DirectorySearch would not be triggered?
i.e.
<Property Id="GALLERY_SETUP_DIR" Secure="no">
	<RegistrySearch Id="GS_Path_Key" Root="HKLM" Key="Software\SMART Technologies\Gallery\Install Information" Name="Install Path" Type="raw" />
</Property>
<Property Id="GS_EXISTS" Secure="no">
	<![CDATA[GALLERY_SETUP_DIR]]>
	<DirectorySearch Id="GS_Search" Path="[GALLERY_SETUP_DIR]" Depth="1">
		<FileSearch Id="GS.exe" Name="Gallery Setup.exe" MinVersion="1.0.1.0" />
	</DirectorySearch>
</Property>
<SetDirectory Id="GALLERY_SETUP_DIR" Action="SetGSDir" Value="[GALLERY_SETUP_DIR]">GALLERY_SETUP_DIR And GS_EXISTS</SetDirectory>

Thanks,

Tim. 

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Lewis Henderson
Sent: Tuesday, April 05, 2016 12:58 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Using RegistrySearch, with Directory/File search to get Directory issue

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/

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



More information about the wix-users mailing list