Menu

#386 value of ${__SECTION__} in hidden section

2.0 Series
closed
Wizou
Scripting (152)
5
2010-06-16
2007-09-04
Anonymous
No

In a hidden section but having a name with a '-' prefix, macro __SECTION__ is defined but empty

Could you change this so it contains the name of the section, without any prefixes ? (as the documentation asserts)

Section "-Test"
!ifdef __SECTION__
!error "Defined: ${__SECTION__}"
!endif
EndSection

Currently it displays
Defined:

My request is to make it display
Defined: Test

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I would like to place this problem in a slightly broader context: Currently NSIS does not store the name of a hidden section. This is illogical (or at least counterintuitive) for the following reasons:
    - If you support the use of a - in a section name to hide that section, you must also support that section name itself. Otherwise, you should only support hiding by using "" (empty) section names.
    - The documentation states: "If section_name is empty, omitted, or begins with a -, then it is a hidden section". It does not state that if a name begins with a -, it will be omitted.
    - The compiler accepts section names starting with dashes, without giving a warning that the name will be ignored.

    The solution is simple enough: Make NSIS store section names even for hidden sections. This brings some other advantages as well:
    - One might want to unhide a section at some point, or maybe enable/disable the section while it remains hidden. This would become a lot easier if one could refer to it with a name.
    - LogicLib isn't always able to report the location of a script error. It would report something like "Error: could not resolve label "_LogicLib_Label_63" in unnamed install section (0)". Since the documentation never states that hidden sections are nameless, the user will be confused: He doesn't know he has any nameless sections. More generally, finding the error will be easier if the compiler would return the name of the section instead of the number. Because as far as the programmer is concerned, the sections do have names.

    Forum username: MSG
    IRC nick: Message

     
  • Wizou

    Wizou - 2010-06-16

    Completed: At revision: 6107

    Note: For now, the name is still not stored in the installer. Most of what MSG suggest is done using the section_index (which is available even for hidden section), not the name of the section

     
  • Wizou

    Wizou - 2010-06-16
    • assigned_to: kichik --> wizou
    • status: open --> closed
     
  • Wizou

    Wizou - 2010-06-16

    Done in latest CVS version, thanks.

     

Log in to post a comment.