Create Directory with name from Property

3 messages Options
Embed this post
Permalink
EricT-in-Ottawa

Create Directory with name from Property

Reply Threaded More More options
Print post
Permalink
I'm trying to (using WiX V2) create a directory where the name is supplied via CustomAction.  The customaction determines the name and creates a property (I've also supplied the property on the msiexec command-line, same diff).  But I don't know how to specify the LongName and Name fields of the Directory (as well as a shortcut created on the desktop that should have the same visible name as the property) so that the value is taken from the property.
I tried
<Directory Id='CustomDir' Name='[SHORTDIRECTORY]' LongName='[LONGDIRECTORY]'>
   <Component Id=...>
      <CreateFolder/>
      <Shortcut Id='CustomDirSc' Directory='DesktopFolder' Name='[SHORTDIRECTORY]'
             LongName='[LONGDIRECTORY]' WorkingDirectory='CustomDir'/>
   </Component>
</Directory>
 but it actually creates a real folder called [LONGDIRECTORY], with square brackets and all.  
If anybody could point me at how to specify a directory and Shortcut in the way I need it, I'd be happy!
Thanks,
Eric T.
Richard-45

Re: Create Directory with name from Property

Reply Threaded More More options
Print post
Permalink

In article <[hidden email]>,
    EricT-in-Ottawa <[hidden email]>  writes:

> I'm trying to (using WiX V2) create a directory where the name is supplied
> via CustomAction.  The customaction determines the name and creates a
> property [...]

The reason this doesn't work is that the column data type for the
Directory table isn't Formatted, so properties are not substituted
into the text that is generated for the filename.

You could write an immediate mode custom action that would update the
Directory table with the desired directory name after you've sanitized
the input to validate it as a long and short filename.  Then you
proceed normally and let Windows Installer create the directory with
the associated name.  This would be the most robust way to attack the
problem.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
      <http://www.xmission.com/~legalize/book/download/index.html>

        Legalize Adulthood! <http://blogs.xmission.com/legalize/>

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
EricT-in-Ottawa

Re: Create Directory with name from Property

Reply Threaded More More options
Print post
Permalink
I've rewritten the database and the directory created now has the proper name.  Thanks!  I'm also supposed to create a shortcut on the desktop to that directory, and the name of the shortcut should be the same as the name of the directory.  I've now run into the same problem I think: the name cannot be set because of formatting.  I'm trying to rewrite this table as well, but I get error 'ERROR_FUNCTION_FAILED'.  Any clues what to do?

Richard-45 wrote:
In article <14196967.post@talk.nabble.com>,
    EricT-in-Ottawa <erict@powersoft.ca>  writes:

> I'm trying to (using WiX V2) create a directory where the name is supplied
> via CustomAction.  The customaction determines the name and creates a
> property [...]

[...]
You could write an immediate mode custom action that would update the
Directory table with the desired directory name after you've sanitized
the input to validate it as a long and short filename.  Then you
proceed normally and let Windows Installer create the directory with
the associated name.  This would be the most robust way to attack the
problem.
[...]