How to make NSIS create a file in an %APPDATA% of another user?

Posted by SCO on Stack Overflow See other posts from Stack Overflow or by SCO
Published on 2012-06-08T15:00:36Z Indexed on 2012/06/08 16:40 UTC
Read the original article Hit count: 235

Filed under:
|
|

I wrote an NSIS installer script for postgresql 9.1. The installer works properly, but after the reboot, the service is not started (right after the install, the database started properly though)

I guess this is because the postgres service user has no pgpass.conf file in its %APPDATA%. As far as I understand my install script, the pgpass.conf file is added to the %APPDATA% of the user running the installer (an administrator account in my case). This will not help.

I tried the following, to add the pgpass.conf to all users, bt I guess this adds it to a kind of wildcard, not to the %APPDATA% of each user :

SetShellVarContext "all"
SetOutPath "$APPDATA\postgresql"
File config\pgpass.conf
SetShellVarContext "current"
SetOutPath "$APPDATA\postgresql"
File config\pgpass.conf

I couldn't find the macro name for c:/Users/postgres in the documentation. This could be a way to achieve it. But with WindowsXP, 7, I wish I need a portable way to address the /Users directory.

I wish I could use something like SetShellVarContext "postgres", and then have NSIS write the pgpass.conf file in c:\Users\postgres\AppData\postgresql.

Is there a way to do this ?

Thnk you !

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about nsis