Archive: Section executes even though its not checked


Section executes even though its not checked
My install prog has 3 sections, one required for the program, and two for creating shortcuts. the desktop shortcuts section seems to execute even if its unchecked, and executes twice if checked. I'm not using any InstType groups. I just want the three options. Any ideas why its doing this? I'm using NSIS 1.94.

Section "HiT-SQUAD Alpha 0.50 (required)"
;Install Files
SetOutPath $INSTDIR
SetCompress Auto
SetOverwrite on
File /r testbuild\*.*
SectionEnd

SectionDivider " shortcuts "

Section "Desktop Shortcut"
CreateShortCut "$DESKTOP\HiT-SQUAD.lnk" "$INSTDIR\Bin\SeriousSam.exe" "+game hit-squad" "$INSTDIR\mods\hit-squad\hs.ico" 0
SectionEnd

Section "Start Menu Shortcut"
CreateDirectory "$SMPROGRAMS\HiT-SQUAD"
CreateShortCut "$SMPROGRAMS\HiT-SQUAD\HiT-SQUAD.lnk" "$INSTDIR\Bin\SeriousSam.exe" "+game hit-squad" "$INSTDIR\mods\hit-squad\hs.ico" 0
CreateShortCut "$SMPROGRAMS\HiT-SQUAD\Start Dedicated HS Server.lnk" "$INSTDIR\Bin\DedicatedServer.exe" "DefaultHS +game hit-squad" "$INSTDIR\mods\hit-squad\hs.ico" 0
; CreateShortCut "$SMPROGRAMS\HiT-SQUAD\Uninstall.lnk" "$INSTDIR\Mods\hit-squad\Uninst.exe"
SectionEnd

edit: also, when i compile the script, it says I have 4 sections (1 required). That should be 3 sections (1 required).

edit: hrmm, it seems that if I comment out SectionDivider " shortcuts " that fixes it. I'd rather not have to comment out the divider. Any ideas why this command would screw things up?


anyone?


I've reproduced this behaviour with this small script:

Name "Test"
OutFile "Test-Setup.exe"

Section
MessageBox MB_OK "Section 1"
SectionEnd

SectionDivider " divider "

Section
MessageBox MB_OK "Section 2"
SectionEnd


and I think this is a bug in NSIS.

~ Florian

A better sample would be

Name "Test"
OutFile "Test-Setup.exe"

ComponentText " "

Section "Section 1"
MessageBox MB_OK "Section 1"
SectionEnd

SectionDivider " divider "

Section "Section 2"
MessageBox MB_OK "Section 2"
SectionEnd


Section 2 will be executed even if it's unchecked an if it's checked it will be executed twice. Leaving the divider, all worked fine.

~ Florian

I changed the following if statement in script.cpp line 729:

if (secname[0]=='-')
{
if (!n)
{
ERROR_MSG("Error: SectionDivider cannot be first section\n");
return PS_ERROR;
}
build_cursection=NULL;
entry ent={EW_RET,};
cur_entries->add(&ent,sizeof(entry));
build_header.common.num_entries++;
}

Now all seems well. :)

Robert


Sorry, that is build.cpp not script.cpp :(


Thanks rainwater! That worked great.


Now, if Justin could only update the release soon before people go crazy trying to figure out why the installer is not working. :)


*bump*

Just wanted to bump this topic to make sure it doesnt get lost.


Thank goodness for these forums! :)

(Not to mention the many thanks to Justin and contributors like Michael, for NSIS)

I would doubtlessly have spent many (frustrating) hours wondering why my installer was messed up if not for this info.

I have developed a LiteStep installer using NSIS 1.67 and I would really like to upgrade to 1.94 or any newer versions that come out.

I'm wondering - as long as I don't use dividers in my installer will I be fine...? That's what the posts above seem to indicate, but I'd just like to be certain before making the jump from 1.67 to 1.94. ;)

Any other bugs in 1.94 I should watch out for? ;)

Thanks in advance.


Yes, its just a problem with using section dividers. There aren't any other major bugs that I known about. If you really want to use section dividers, I can send you a fixed version.


Thank you rainwater!

I'm glad to hear that (as far as you know) there aren't any other major concerns with 1.94.

And I gladly accept your generous offer - I would love to have your version with the build.cpp fix. :D