Hi,

 

In the WiX tutorial is a sample that does:
  - reads the path to the installation directory from the registry
  - checks if in that directory a specific file exists
  - if yes, installs the a specific feature (docu)
What I would have wanted would have been:
  - reads the path to the installation directory from the registry
  - checks if in that directory a specific file exists OR checks if in the 
default path (created by the nested Directory tags) the file exists
  - if yes, installs the docu feature

I thought that by doing the FILEEXIST File search by using the INSTALLDIR would 
mean that the File search is done in the INSTALLDIR which is either the 
registry value if that one exists in the registry, OR the default directory 
paths specified by nested Directory tags if the registry value was not found. 
But it seems that when the FILEEXIST condition is evaluated the INSTALLDIR is 
set to whatever was found in the registry, which means if the registry entry 
was not found, at this point the INSTALLDIR will be empty and it won't be, as I 
expected, the nested Directory tags we specified.

 

[code]
    <!-- Check if in the registry we have already saved the path where the app 
should be installed -->
    <Property Id="INSTALLLOCATION">
      <RegistrySearch Id="MyPathsFromRegistry" Type="raw" Root="HKLM" 
Key="Software\MySetup" Name="InstallDir"/>
    </Property>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="MyFirstSetup" Name="MyFirstSetup">
          <Directory Id="INSTALLLOCATION" Name="MyFirstSetup1.0">
            
            <Component Id="MyExe" Guid="9660051E-43CA-4459-AEF1-290BBE3DE544">
              <File Id="MyMainExe" Name="MyApp.exe" 
Source="..\MyApp\Debug\MyApp.exe" DiskId="1" KeyPath="yes"/>
            </Component>

            <Component Id="MyDocumentation" 
Guid="5D64FD41-B8FF-4B77-8777-4CFD81855A0B">
              <File Id="MyDocu" Name="readme.txt" 
Source="..\MyApp\Debug\readme.txt" DiskId="1" KeyPath="yes"/>
            </Component>

          </Directory>
        </Directory>
      </Directory>
    </Directory>
    
    <!-- check if in the installation directory (egal if it's the one gathered 
from registry or the default one) has a lookfor.txt file and if not don't 
install the documentationc -->
    <!-- !!! ACTUALLY !!! for some reason, when the following Property is 
evaluated the INSTALLLOCATION is set to whatever was in the registry, and if no 
key was found in the registry this value is empty, so it was not yet set to 
whatever default directory path was specified with the nested Directory tags-->
    <Property Id='FILEEXISTS'>
      <DirectorySearch Id='DirSearch' Path='[INSTALLLOCATION]' Depth='0'>
        <FileSearch Id='FileSearch' Name='lookfor.txt'/>
      </DirectorySearch>
    </Property>
    
    <Feature Id="CompleteExe" Level="1">
      <ComponentRef Id="MyExe" />
    </Feature>
    <!-- install this feature only if you find the lookfor.txt file (Level 0 
means the feature won't be installed) -->
    <Feature Id="CompleteDoc" Level="1">
      <ComponentRef Id="MyDocumentation" />
      <Condition Level="0"> NOT FILEEXISTS </Condition>
    </Feature>
[/code]

 

How can I do so that the FileSearch is done in INSTALLLOCATION whereas the 
INSTALLLOCATION is either the registry entry if found or the nested directory 
tag if registry entry was not found?

 

TIA,
Viv

                                          
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to