Archive: Multiple Install Paths


Multiple Install Paths
Hi,

I am trying to update a previous installer (one that I did not write) to handle installing on Vista.

The way it is now, the default installation directory is "$PROGRAMFILES\[app name]". This is to remain the same.

What I need is to set a different path when the installer in running on Vista.

I thought I had a good (one that would work) method to accomplish this but seem to have run into a snag. The following is part of what I have / do.

First, I use GetVersion::WindowsName and store it in $R0. Next, I used this

${if} $R0 == "Vista"
StrCpy "$DefaultDir" "$APPDATA\[app name]"
${else}
StrCpy "$DefaultDir" "$PROGRAMFILES\[app name"
${endif}

where DefaultDir is just a variable I declared.

When I go to set the default installation directory I thought using

InstallDir "$DefaultDir"

would work, but when the option to select the default directory would happen, that field is blank and I must browse to get the path.

Any ideas on how I can go about getting this to work properly? Any suggestions would be greatly appreciated.

thanks


Much easier:

!include WinVer.nsh

InstallDir "$PROGRAMFILES\[app name]"

${If} ${AtleastWinVista}
StrCpy $INSTDIR "$APPDATA\[app name]"
${EndIf}


The ${If} block can go in .onInit or anywhere before the directory page.

Stu

hi,
If you are using MUI you should define set $INSTDIR value:
quoting from MUI manual

MUI_DIRECTORYPAGE_VARIABLE variable
Variable in which to store the selected folder.
Default: $INSTDIR


Thanks for the quick replys. I'll try that.