La détection de la présence d'un répertoire à l'installation

Dans WiX DirectorySearch peut être utilisé pour déterminer si un répertoire existe sur l'ordinateur cible. Mais je ne comprends pas si il y a une manière cohérente pour déterminer qu'un répertoire ne pas existent.

Par exemple:

<Property Id="INSTALLDIR" Secure="yes">
  <RegistrySearch Id='InstallDir' Type='directory'
    Root='HKLM' Key='Software\Company\Product\Install' Name='InstallPath'/>
</Property>
<Property Id='IS_INSTALLED' Secure='yes'>
  <DirectorySearch Id='IsInstalled' Path='[INSTALLDIR]' />
</Property>

Lorsque la clé de registre ainsi que le répertoire existe pas, le IS_INSTALLED propriété est définie sur le chemin retourné par DirectorySearch.

Si le répertoire n'existe pas, IS_INSTALLED semble être fixé à "C:\".

Est une condition du type:

<Condition>NOT (IS_INSTALLED = "C:\")</Condition>

un moyen fiable de détecter que le répertoire a été trouvé? Est-il un meilleur moyen?

Réponse: Voici WiX code basé sur mrnxs répondre que j'ai accepté

<Property Id="PRODUCT_IS_INSTALLED" Secure="yes">
  <RegistrySearch Id='RegistrySearch1' Type='directory'
    Root='HKLM' Key='Software\Company\Product\Version\Install' Name='Path'>
    <DirectorySearch Id='DirectorySearch1' Path='[PRODUCT_IS_INSTALLED]'/>
  </RegistrySearch>
</Property>

<CustomAction Id='SET_INSTALLDIR'
              Property='INSTALLDIR'
              Value='[PRODUCT_IS_INSTALLED]'/>

<InstallExecuteSequence>
  <Custom Action='SET_INSTALLDIR' After='AppSearch'></Custom>
</InstallExecuteSequence>

OriginalL'auteur Brian Gillespie | 2011-02-08