No announcement yet.

SectionIsSelected not working ... Or is it me

  • Filter
  • Time
  • Show
Clear All
new posts

  • SectionIsSelected not working ... Or is it me

    I have a Pre-Install Processing section that contains the following lines:

    ${If} ${SectionIsSelected} 'Main'
    !insertmacro logme ${INSTLOG} "Extracting Files for x86 Installation ... Please be Patient" b
    SetOutPath $INSTDIR\${APP_NAME}\32bit
    File /r /x "*.svn" /x "*${APP_NAME}*.*" "${INSTALL_SOURCE}\${APP_NAME}\32bit\*.*"
    SetOutPath $INSTDIR\${APP_NAME}

    ${If} ${SectionIsSelected} 'Secondary'
    !insertmacro logme ${INSTLOG} "Extracting Files for x64 Installation ... Please be Patient" b
    SetOutPath $INSTDIR\${APP_NAME}\64bit
    File /r /x "*.svn" /x "*${APP_NAME}*.*" "${INSTALL_SOURCE}\${APP_NAME}\64bit\*.*"
    SetOutPath $INSTDIR\${APP_NAME}

    It does not appear to be functioning. And don't let the if line throw you on context, I have tried each of the following:
    ${If} ${SectionIsSelected} 'Main'
    ${If} ${SectionIsSelected} Main
    ${If} ${SectionIsSelected} ${Main}
    ${If} ${SectionIsSelected} '${Main}'

    Am I missing something on how the context should be... Section Main and Secondary function exactly as they should, this is the only part not working... It is almost like it never checks if the SF_SELECTED is set..



  • #2
    Just like SectionGetFlags etc. you give it the zero-based section index, which is optionally defined as a compile time constant if you specify one as the last parameter for Section.

    Look at the LogicLib.nsi example script.



    • #3
      Expanding upon the previous answer -
      Your code is checking section 0 (because Main and 'Main' are strings without any other numeric equivalent). ${Main} is a 'defined' constant which (could be) set as the section index if you used statements like
      Section /o "The Main" Main
      Section /o "Another OS" Secondary
      Function blah
      ${If} ${SectionIsSelected} ${Main}

      . You have to be careful that the Section statement occurs before (ie, is compiled before) the Pre-Install processing code that tries to use the defined constant, otherwise the test will again be testing section 0.


      • #4
        I had a long reply typed up and was just getting ready to submit when i caught the last part of your port demiller...

        In Layman's terms:
        Since I am trying to inquire on the status of ${Main}, it is referencing it prior to ${Main} being defined. At compile time it does not know how to reference it. Just as long as a I do the SectionIsSelected AFTER Section "" Main, it would not be an issue.. Since it is compiling in a linear fashion.

        That is what I am gathering... If that is the case I got ya.. Thanks...

        And yes Afrow, that is exactly what you said, just not so much as a Layman... LOL Thanks to you too...


        • #5
          great! it's working as it should!
          thank you!