uranium
6th June 2007 13:49 UTC
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.
Afrow UK
6th June 2007 14:11 UTC
Just check the value of $1 in the page's leave function:
!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
uranium
6th June 2007 17:24 UTC
Thanks a lot!
uranium
7th June 2007 09:22 UTC
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
7th June 2007 10:02 UTC
Thanks. I managed to solve the issue using method GetAfterChar described on http://nsis.sourceforge.net/Get_last...tory_path_part