Reputation: 327
I need to write a ini file to the current user's directory in Windows 7 (C:\Users\CurUser). CurUser is not an admin. My installer requires admin privileges. So my setup looks like this:
[Setup]
PrivilegesRequired=admin
When I run the installer it prompts for the admin to login. From that point on, all the user constants, userappdata, etc, are C:\Users\AdminUser... So I need a way to find the CurUser when running the install as AdminUser.
Code examples are appreciated. Thanks.
Upvotes: 5
Views: 4299
Reputation: 691
In my case, I just switched to {commonappdata}
instead of {appdata}
, as my data was the same for all users.
Upvotes: 1
Reputation: 13327
You should split your setup into two parts. The first non-admin part writes the ini file to the current user directory and it calls the second setup part which requires admin priviliges.
Upvotes: 3
Reputation: 24283
All user specific files/settings that the app requires should be written by the app if they are found not to exist. If it needs to come from the setup, you can write it into a global location as a "default" for the app to copy or use.
This also means your app will work for ALL users on the system rather than just the user that ran the setup.
Upvotes: 3