Old 6th June 2007, 12:49   #1
uranium
Junior Member
 
Join Date: Jun 2007
Posts: 4
customizing install directory

Hi, I have too mutually exclusive options to install application. Let's say they are KEEDS and TEENS.

Here it is piece of installer script:

Section "Kids" KIDS
...
SectionEnd

Section /o "Teens" TEENS
...
SectionEnd

Function .onInit

StrCpy $1 ${KIDS} ; Kids is selected by default

FunctionEnd

Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${KIDS}
!insertmacro RadioButton ${TEENS}
!insertmacro EndRadioButtons
FunctionEnd


InstallDir "$PROGRAMFILES\MyProgram"

I want to set installation dir depends on choosen option either "$PROGRAMFILES\MyProgram.kids" or "$PROGRAMFILES\MyProgram.teens"

How to do that? Thanks.
uranium is offline   Reply With Quote
Old 6th June 2007, 13:11   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Just check the value of $1 in the page's leave function:
code:

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ComponentsPageLeave
!insertmacro MUI_PAGE_COMPONENTS

Function ComponentsPageLeave
StrCmp $1 1 0 +3
StrCpy $INSTDIR "$PROGRAMFILES\MyProgram.kids"
Goto +2
StrCpy $INSTDIR "$PROGRAMFILES\MyProgram.teens"
FunctionEnd



Stu
Afrow UK is offline   Reply With Quote
Old 6th June 2007, 16:24   #3
uranium
Junior Member
 
Join Date: Jun 2007
Posts: 4
Thanks a lot!
uranium is offline   Reply With Quote
Old 7th June 2007, 08:22   #4
uranium
Junior Member
 
Join Date: Jun 2007
Posts: 4
Additional but related question about Uninstall section. Let's assume code written above gives us customized name of application folder stored in $name variable. And I create shortcuts etc using that name:

CreateShortCut "$DESKTOP\$name.lnk" "$INSTDIR\MyProgram.exe"

Question is how to say Uninstaller to delete correctly this shortcut.
Following code in Uninstall section doesn't work:

Delete "$DESKTOP\$name.lnk"

How to handle uninstall correctly in this case? Thanks.
uranium is offline   Reply With Quote
Old 7th June 2007, 09:02   #5
uranium
Junior Member
 
Join Date: Jun 2007
Posts: 4
Thanks. I managed to solve the issue using method GetAfterChar described on http://nsis.sourceforge.net/Get_last...tory_path_part
uranium 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