overwrite default InstallDir
Hi,
I want to set the installation directory depending on selected components. I tried:
"!define MUI_DIRECTORYPAGE_DEFAULT_FOLDER $PROGRAMFILES\$ComponentName" But it doesn't work !!
Can somebody help me?
Archive: overwrite default InstallDir
overwrite default InstallDir
Hi,
I want to set the installation directory depending on selected components. I tried:
"!define MUI_DIRECTORYPAGE_DEFAULT_FOLDER $PROGRAMFILES\$ComponentName" But it doesn't work !!
Can somebody help me?
Hope the following example could help you manage it :-)
name 'ChangeDirectory test'
outfile 'ChangeDirectory.exe'
InstallDir '$PROGRAMFILES\ChangeDirectoryTest'
!include "Sections.nsh"
page components
page directory 'dir_pre'
page instfiles
Section "Components 1" SEC_01
SetOutPath '$INSTDIR'
SectionEnd
Section /o "Components 2" SEC_02
SetOutPath '$INSTDIR'
SectionEnd
Section /o "Components 3" SEC_03
SetOutPath '$INSTDIR'
SectionEnd
Function .onInit
StrCpy $1 ${SEC_01}
FunctionEnd
Function dir_pre
StrCmp '$1' '${SEC_01}' 0 +3
StrCpy '$INSTDIR' '$PROGRAMFILES\Component 1'
goto done
StrCmp '$1' '${SEC_02}' 0 +3
StrCpy '$INSTDIR' '$PROGRAMFILES\Component 2'
goto done
StrCmp '$1' '${SEC_03}' 0 done
StrCpy '$INSTDIR' '$PROGRAMFILES\Component 3'
done:
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC_01}
!insertmacro RadioButton ${SEC_02}
!insertmacro RadioButton ${SEC_03}
!insertmacro EndRadioButtons
FunctionEnd