ikreb
ikreb

Reputation: 2785

NSIS: Switch between 3.X versions

I want to have my script compatible with nsis-3.03 and nsis-3.04. I know this:

!if 0n1 > 0 ; >= 3.0b0 
!endif

But I don't understand why 0n1 > 0 means >= 3.0b0?

I want to do something like

!if ... ; version=[3.0-3.3]
    ; do stuff
!else if  .., ; version > 3.3
    ; do other stuff
!else
     ; pass
!endif

I can`t use ${NSIS_PACKEDVERSION}, because it is wrong build at debain based systems.

Upvotes: 0

Views: 84

Answers (1)

Anders
Anders

Reputation: 101736

!if 0n1 > 0 ; >= 3.0b0 works because older versions do not understand 0n1 and treats it as 0 so it just becomes 0 > 0 in older versions.

NSIS v3.04 and later forces NSIS_PACKEDVERSION to be a somewhat usable value even if nobody specifies a version when compiling.

To detect a specific feature implemented in a .NSH you can just check if the define or macro exists, there is no need to do a version check:

!include x64.nsh
!ifdef IsNativeMachineArchitecture
...
!else
...
!endif

Upvotes: 1

Related Questions