Inno Setup User Home Path

2019-02-24 22:29发布

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.

4条回答
Viruses.
2楼-- · 2019-02-24 22:45

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

查看更多
唯我独甜
3楼-- · 2019-02-24 22:46

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.

查看更多
甜甜的少女心
4楼-- · 2019-02-24 22:53

I support the idea of being able to put files into the user profile directory. The files are not "documents" that would go into the {userdocuments} folder and they are not files to be hidden from the user that would go into {userappdata}. I don't see the logic behind the restriction that microsoft (and inno) seem to be imposing here.

查看更多
爷、活的狠高调
5楼-- · 2019-02-24 22:59

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).

查看更多
登录 后发表回答