Skip to content
⌘ NSIS Forum Archive

Variable for OutFile

3 posts

tieum#

Variable for OutFile

Hello,

Right now I have two redundant defines and I would like to merge them. FOr this I am looking either to use a variable (not a define) for Outfile or to define a define using if/else.

Let me illustrate

In some case I use

!define CODE_PLATFORM win32
!define NICE_PLATFORM " for Windows XP"
in others I use

!define CODE_PLATFORM win64
!define NICE_PLATFORM " for Windows XP 64 bits"
The main nsh script contains

OutFile MyFile${NICE_PLATFORM}.exe

[...]

File $REPOSITORY\$CODE_PLATFORM\somebinary
I would like to merge the two defines in one

!define PLATFORM 32 (or 64)
Waht solution would I have after to either:

1) use if/defs

"IF" $PLATFORM == 32
!define CODE_PLATFORM win32
!define NICE_PLATFORM " for Windows XP"
"ELSE"
!define CODE_PLATFORM win64
!define NICE_PLATFORM " for Windows XP 64 bits"
"FI"
or 2) variables:

Var CODE_PLATFORM
Var NICE_PLATFORM

Function .onInit
${If} $PLATFORM == 32
StrCpy CODE_PLATFORM win32
StrCpy NICE_PLATFORM " for Windows XP"
${Else}
StrCpy CODE_PLATFORM win64
StrCpy NICE_PLATFORM " for Windows XP 64 bits"
${Endif}
I hope I am not too confuging.

Thanks in advance,
Afrow UK#
It depends whether you want two different builds of your installer (one for win32 and one for win64) using compile time defines (!define) or have a single installer and determine what to install at run time using variables. You cannot use run time variables at compile time of course.

Stu