[wix-users] How to do a conditional FileSearch?

Lewis Henderson henderso at opentext.com
Fri Feb 3 11:24:00 PST 2017


Hi again Fyodor,

Thanks for the suggestion.  I got sidetracked by other work, but finally got back to this and nesting the DirectorySearch/FileSearch in a (redundant) RegistrySearch did the trick.  There's the resulting code:

    <Property Id="JDK_VERSION" Secure="yes">
      <RegistrySearch Id="jdk_ver" Root="HKLM"
                      Key="Software\JavaSoft\Java Development Kit"
                      Name="CurrentVersion" Type="raw" />
    </Property>
    <Property Id="JDK_HOME" Secure="yes">
      <RegistrySearch Id="jdk_home" Root="HKLM"
                      Key="Software\JavaSoft\Java Development Kit\[JDK_VERSION]"
                      Name="JavaHome" Type="raw" />
    </Property>
    <Property Id="JDK_JVM" Secure="yes">
      <RegistrySearch Id="jdk_dir" Root="HKLM"
                      Key="Software\JavaSoft\Java Development Kit\[JDK_VERSION]"
                      Name="JavaHome" Type="directory">
        <DirectorySearch Id="jdk_jvm" Depth="3">
          <FileSearch Name="jvm.dll" />
        </DirectorySearch>
      </RegistrySearch>
    </Property>

Thanks again,

				Lewis


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Fyodor Koryazhkin
Sent: Friday, February 3, 2017 10:33 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] How to do a conditional FileSearch?

Hi,
I see, sorry.
As far as I know there is no predefined order in AppSearch table (This is the table that triggers all other searches). Also there is no condition.
If you need all the properties then you should search several times: first time only for registry, the second time for registry and directory(nested) and the third time for the file (Also nested). Every search you assign do different property.

On Fri, Feb 3, 2017 at 5:25 PM, Lewis Henderson <henderso at opentext.com>
wrote:

> Thanks Fyodor,
>
> But the AssignToProperty is a YesNoType parameter according to the 
> spec, and causes only the path itself to be assigned to a property 
> instead of the complete filespec.
>
>                                 Lewis
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On 
> Behalf Of Fyodor Koryazhkin
> Sent: Friday, February 3, 2017 10:13 AM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] How to do a conditional FileSearch?
>
> Try to put DirectorySearch element under the RegistrySearch element:
> <Property Id="JDK_HOME" Secure="yes">
>
>       <RegistrySearch Id="jdk_home" Root="HKLM"
> Key="Software\JavaSoft\Java Development Kit\[JDK_VERSION]"
> Name="JavaHome" Type="raw">
>          <DirectorySearch Id="jdk_jvm" Path="[JDK_HOME]" Depth="3"
> AssignToProperty=JDK_JVM >
>
>             <FileSearch Name="jvm.dll" />
>
>       </DirectorySearch>
>
>      </RegistrySearch>
>
>     </Property>
>
> On Fri, Feb 3, 2017 at 4:15 PM, Lewis Henderson 
> <henderso at opentext.com>
> wrote:
>
> > Hi Everyone,
> >
> > I posted earlier under a different (more obscure) subject and got no 
> > replies, so here's the crux of the matter.  I have a WiX installer 
> > which does a FileSearch based on a path from a RegistrySearch.  This 
> > is all fine and dandy as long as the RegistrySearch succeeds, but 
> > things go awry if it fails.  Is there any way to conditionally skip 
> > the FileSearch if the RegistrySearch comes up empty?  Here's the
> relevant code:
> >
> >
> >     <Property Id="JDK_VERSION" Secure="yes">
> >
> >       <RegistrySearch Id="jdk_ver" Root="HKLM"
> >
> >                       Key="Software\JavaSoft\Java Development Kit"
> >
> >                       Name="CurrentVersion" Type="raw" />
> >
> >     </Property>
> >
> >     <Property Id="JDK_HOME" Secure="yes">
> >
> >       <RegistrySearch Id="jdk_home" Root="HKLM"
> >
> >                       Key="Software\JavaSoft\Java Development 
> > Kit\[JDK_VERSION]"
> >
> >                       Name="JavaHome" Type="raw" />
> >
> >     </Property>
> >
> >     <Property Id="JDK_JVM" Secure="yes">
> >
> >       <DirectorySearch Id="jdk_jvm" Path="[JDK_HOME]" Depth="3">
> >
> >         <FileSearch Name="jvm.dll" />
> >
> >       </DirectorySearch>
> >
> >     </Property>
> >
> > Thanks for any help you can provide.
> >
> >                                                                 
> > Lewis
> >
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant 
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.co
> > m_
> > &d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxaueKkO
> > 53 
> > V282tTn1P4&m=UrJiWIHp1gTBpXnCfCi-avw83fVvJsG4dRRRtEb0ZIw&s=KO8-38c07
> > 7L
> > iQ7Ojb3KbmGI2UyrVXIFLFnByrL2EhL8&e=
> >
>
>
>
> --
> Regards,
> Fyodor Koryazhkin..
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.
> firegiant.com_&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=
> yAhF6NGJ7EPmZkvswZOswwnYxaueKkO53V282tTn1P4&m=UrJiWIHp1gTBpXnCfCi-
> avw83fVvJsG4dRRRtEb0ZIw&s=KO8-38c077LiQ7Ojb3KbmGI2UyrVXIFLFnByrL2EhL8&
> e=
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_
> &d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxaueKkO53
> V282tTn1P4&m=HUCIFFMYAWKDHtkZtZP6-_XQhRORQ1O8IThI7jddReU&s=oPvjnMwIV43
> -r3iPJ74wJ_7PcztRprlTmwtWctw7PmQ&e=
>



--
Regards,
Fyodor Koryazhkin..

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxaueKkO53V282tTn1P4&m=HUCIFFMYAWKDHtkZtZP6-_XQhRORQ1O8IThI7jddReU&s=oPvjnMwIV43-r3iPJ74wJ_7PcztRprlTmwtWctw7PmQ&e= 


More information about the wix-users mailing list