4
votes

I would like my installer to put some files into a users home path, (the path that the Windows %USERPROFILE% environment variable points to, and the path Qt's QDir::homePath() returns).

I have looked at the Inno Setup Constants page, but can't find the path I am looking for.

3
You should never put files in the root of a user profile directory.ZippyV
Also, installers (that install per-machine, which is the default) should never write files in per-user folders anyway. Leave that to the application.Miral
@ZippyV I think it is not right to forbid something generally. I want to add ssh key which has to be added to HOME/.ssh/ folder and I would like to create this folder as well from inno setup if its not there so I think there could be legit need.zar
@zadane What happens if a different user launches your application? Even if you have no choice (because of SSH's bad behavior) you should still not do it during install time because a different user might use your application as well.ZippyV

3 Answers

29
votes

Use environment variables {%USERPROFILE} or {%HOMEPATH}.

Update

As Martin pointed out in the comments, {%HOMEPATH} shouldn't be used because it has no disk name (e.g., \Users\username).

2
votes

For user specific application data you should use the constant {userappdata} which points to the application data folder. In this location you can create a folder for your application to store user specific files in.

0
votes

Updates from @Andreas, suppose you have a file with contents and it needs to be set to users home directory

1) C:\Users\sun\Desktop\.appcfg_nag:

opt_in: false
timestamp: 0.0

2) InnoSetup you can do like below copy paste:

[Files]
Source: "C:\Users\sun\Desktop\.appcfg_nag"; DestDir: "{%HOMEPATH}"; Flags: ignoreversion

Now, the file .appcfg_nag will be located in C:\Users\sun\.appcfg_nag