Thanks to some off list help from Levi Wilson, I now have the following 
solution...

 

<?xml version='1.0' encoding='windows-1252'?>

<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>

  <Fragment Id='PdfFragment'>

 

    <Property Id="PDFFOLDEREXISTS">

      <DirectorySearch Id="PdfFolderSearch" Path="[SourceDir]pdf\" />

    </Property>

    

    <CustomAction Id='SetPdfFolder' Property='SourcePdfDir' 
Value='[SourceDir]pdf\'/>

 

    <DirectoryRef Id='PdfFolder'>

      

      <Component Id='PdfComponent' Guid='1DC5A176-1062-4b7d-A2B3-DCD15EE050A9'>

        <Condition>PDFFOLDEREXISTS</Condition>

        

        <CopyFile Id='PdfFiles' DestinationDirectory='PdfFolder' 
SourceProperty='SourcePdfDir' SourceName='*.pdf'/>

        <Shortcut Id="StartMenuPdfFolder" Directory="ProgramMenuDir" Name="PDF" 
LongName="Training Material" WorkingDirectory='PdfFolder'/>

      </Component>

      

    </DirectoryRef>

 

  </Fragment>

</Wix>


________________________________

From: Colin Burn
Sent: Thu 1/11/2007 2:45 PM
To: wix-users@lists.sourceforge.net
Subject: Conditional installation of a shortcut based on a folders existance



Conditional installation of a shortcut based on a folders existence

 

Hi all,

 

I'm tying to create an installer that copies some files from the installation 
media (if they exist) to a location on the target machine. I'm then trying to 
add a start menu entry that points to this location so far I have this fragment 
that does most of the work...

 

<?xml version='1.0' encoding='windows-1252'?>

<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>

  <Fragment Id='PdfFragment'>

 

    <CustomAction Id='SetPdfFolder' Property='SourcePdfDir' 
Value='[SourceDir]pdf\'/>

 

    <DirectoryRef Id='PdfFolder'>

      

      <Component Id='PdfComponent' Guid='1DC5A176-1062-4b7d-A2B3-DCD15EE050A9'>

        <CopyFile Id='PdfFiles' DestinationDirectory='PdfFolder' 
SourceProperty='SourcePdfDir' SourceName='*.pdf'/>

        <Shortcut Id="StartMenuPdfFolder" Directory="ProgramMenuDir" Name="PDF" 
LongName="Training Material" WorkingDirectory='PdfFolder'/>

      </Component>

      

    </DirectoryRef>

 

  </Fragment>

</Wix>

 

The custom action is executed from the InstallExecuteSequence.

 

This all works fine when the pdf folder exists on the install CD but when it 
doesn't I still get the start menu shortcut but it doesn't point to anything. 
So I think that I need to make the component conditional. Which I think means 
that I need to write another custom action that detects is a folder exists on 
the CD and sets a property, but I don't know how to do this. Can somebody help 
me?

 

Cheers

 

Colin

 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to