Old 14th January 2008, 21:13   #1
lanchfn21
Junior Member
 
Join Date: Jan 2008
Posts: 2
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
lanchfn21 is offline   Reply With Quote
Old 14th January 2008, 21:35   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Much easier:
code:
!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
Afrow UK is offline   Reply With Quote
Old 14th January 2008, 21:38   #3
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
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
sgiusto is offline   Reply With Quote
Old 14th January 2008, 22:24   #4
lanchfn21
Junior Member
 
Join Date: Jan 2008
Posts: 2
Thanks for the quick replys. I'll try that.
lanchfn21 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump