6

I am creating an installer for an SDK, which includes source code to be compiled by the end-user.

I want my Wix installer to put this in the users' home directory by default, but I can't find the right property name to use.

Rob
  • 4,210
  • 3
  • 30
  • 25

4 Answers4

5

You could also reference the HOMEPATH environment variable with [%HOMEPATH]. For more detail about the syntax used for properties, see the Formatted datatype.

Dave Andersen
  • 5,337
  • 3
  • 30
  • 29
  • 3
    On a related note, there's also `[%HOMEDRIVE]` which you can prefix to get a full path: `[%HOMEDRIVE][%HOMEPATH]`. Alternatively, `$(env.HOMEDRIVE)$(env.HOMEPATH)` can be used. – Cameron Jan 08 '14 at 16:56
  • 2
    ...ignore the last part of my previous comment, the `$(env.)` versions are evaluated at compile time, not install time! And note there's also `[%USERPROFILE]`. – Cameron Jan 10 '14 at 21:53
  • ...and it turns out that it's possible for `[%HOMEDRIVE][%HOMEPATH]` to be different from `[%USER_PROFILE]`. – Cameron Jan 10 '14 at 22:45
3

I believe you are looking for PersonalFolder.

There is a full list of special folders here:

http://msdn.microsoft.com/en-us/library/aa370905%28VS.85%29.aspx#system_folder_properties

gymbrall
  • 2,063
  • 18
  • 21
  • PersonalFolder is the Documents folder for the current user, I'm looking for the user's actual folder. The Documents folder will do though, so thanks! – Rob Mar 09 '12 at 14:55
2

In case it helps, for WiX v3.11.2.4516 I have used USER_FOLDER like the example below:

<Directory Id="USER_FOLDER">
    ...
</Directory>

EDIT

...having calculated this property with

<Property Id="USER_FOLDER" >
    <DirectorySearch Id="userProfileSearch" Depth="0" Path="[%USERPROFILE]" />
</Property>
Rodrigo
  • 93
  • 1
  • 8
0

Anyone in the future looking into this, and wondering how to make this [%HOMEPATH] work then hopefully this helps you:

<!-- Declare an action which binds the 'user home' to UserFolder 
     (You can replace [%HOMEDRIVE][%HOMEPATH] with [%USERPROFILE], read the difference from internet.) -->
<CustomAction 
     Id='SpecifyUserFolder' 
     Directory='UserFolder'
     Value="[%HOMEDRIVE][%HOMEPATH]" />

<!-- put this before installation process -->
<InstallExecuteSequence>
  <Custom Action="SpecifyUserFolder" Before="InstallFiles" />
</InstallExecuteSequence> 

<!-- User home then becomes available here, because the ID matches the declared ID in CustomAction above. -->
<Directory Id='UserFolder'>
</Directory>'
Joonas Vali
  • 727
  • 6
  • 11