cheryll
29th April 2009 10:31 UTC
programfoldername changeable according to section
Ok, what I try to do is this:
I have an installation with 2 section, one required one optional. I want to change the name of the program folder according to selection of the optional section.
I simply tried to set Installdir on the default (no optional section), and used .onSelChange to set $INSTDIR according to the selection made. That works in so far as that the correct directory is shown as preselect in the directory page.
But when I change the preselected path, the install folder is always reset to the default name, even when I selected the optional section.
Has anyone an idea how to get it to work properly?
Thanks in advance :)
Afrow UK
29th April 2009 11:15 UTC
You should use:
${If} ${SectionIsSelected} ${SectionIndex}
StrCpy $INSTDIR ...
${Else}
StrCpy $INSTDIR ...
${EndIf}
This can go in the directory page's pre function. Make sure it is after the section in your script as well so that SectionIndex has been defined as 1 (or just put 1 if you have only 2 sections).
Stu
cheryll
29th April 2009 11:30 UTC
Well, yes, that's basicly what I do.
But as I said, if I change the default directory I either get the wrong folder name (when I use the Installdir command) or non at all (when I don't use Installdir).
What I'd like would be a way to not only set the default directory flexibly, but also that the program folder name would be suffixed correctly if I change the default.
Afrow UK
29th April 2009 12:02 UTC
Don't use InstallDir - just StrCpy $INSTDIR to whatever.
Stu
cheryll
29th April 2009 12:12 UTC
Yeah, but as I said, if I don't use InstallDir then no program folder is be added to the end when I change the default directory.
Afrow UK
29th April 2009 12:19 UTC
Sorry, but what is wrong with:
StrCpy $INSTDIR `$PROGRAMFILES\$(^Name)`
(or similar)?
Stu
cheryll
29th April 2009 12:33 UTC
Nothing beside the facts that what I'd like it to do doesn't work that way...
If it can't be done without some major fiddling around just tell me, then I'll have to live with it.
Afrow UK
29th April 2009 13:12 UTC
Ah I see what you mean now sorry. You can append the program name to the end in .onVerifyInstDir:
Function .onVerifyInstDir
StrCpy $INSTDIR `$INSTDIR\$(^Name)`
FunctionEnd
Stu
cheryll
29th April 2009 13:31 UTC
Thanks a lot. That's just what I needed.