cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
djappy
Level 2

Problems writing to INSTALLDIR on Vista

My application uses data files which are not user specific and hence I write them into [CommonAppData]/CompanyName/AppName in what appears to be "the Vista way". However, I'd really like this location to be configurable at install time. I therefore would like to write an INI file alongside the application file in c:\Program Files\... to tell the app where all these data files are.
The "solution" I've come up with involves me writing an INI file to INSTALLDIR from a custom action. However, it doesn't work - the call to WriteProfString fails.
I've tried adding Full Control to "Everyone" (no domain specified) on INSTALLDIR in the component view - but this appears to have had no effect.

Is there a workaround to this? An alternative might be to use the registry - but since I'm not user specific, I'd like to write to HKLM but I suspect I'm going to have similar permission problems with the registry.

Does anyone have any advice? I'm using IS2008.

Thanks,
Dave
Labels (1)
0 Kudos
(3) Replies
Stefan_Krueger
Level 9

Why a custom action? Windows Installer supports writing INI files natively.
Stefan Krueger
InstallSite.org
0 Kudos
djappy
Level 2

Two reasons I believe.

Firstly, I need to get this INI file set up after the install has taken place (or at least after the user has chosen file locations) - hence it needs to be in a script.

Second, I need to script it because I need the INI file to be in the App's directory rather than in a user-specific directory.

I'm not entirely clear whether I can avoid custom actions for this, but I'm not sure that the CA is the problem - it appears to be a permissions issue - though I'm not clear what the actual error coming out of WriteProfString is.

I will investigate further
0 Kudos
Stefan_Krueger
Level 9

INI entries you add in the INI Files view will be created after the files ahve been copied so that should work without custom actions.
I'm not sure why your custom action fails. I would need more information about where in which sequewnce it's called and what the in-script execution settings are. But you really shouldn't use a custom action for something that Windows Installer can do out of the box.
Stefan Krueger
InstallSite.org
0 Kudos