Skip to content
⌘ NSIS Forum Archive

Concatenation for OutFile

10 posts

Guest#

Concatenation for OutFile

Hello,

I want to create the outfile in a directory that contains the version, e.g. "c:\output\${version}\setup.exe"

I guess I can create that directory with a !system call. The main problem is that I cannot use StrCpy to set the value:

strcpy $var1 "c:\output\${version}"
#enter system call to create the directory here =)
outfile "$var1\setup.exe"

This is not possible as strcpy is not allowed outside a section.
Is there anyone who would like to create a patch that the outfile directory is created if non-existent?


How can I solve this problem?

Lars
dienjd#
I'm a little confused. Couldn't you do:

CreateDirectory "${version}"
SetOutPath "${version}"
Guest#
Hello dienjd,

it´s not about the system, where the program is to be installed, but about the system, where I create the setup.

I want to keep a history of recent setups and don´t want to have them all in just one directory.
dienjd#
Ah, sorry about that. I completely misunderstood your original post 🙂

A quick suggestion would be to make a batch file that creates your ${version} directory and then compiles your NSI script to output your EXE into your newly created directory.

Another option would be to just append your ${version} value to your EXE's filename--that would leave all your builds in 1 directory though.
Guest#
Originally posted by dienjd
Ah, sorry about that. I completely misunderstood your original post 🙂
Nevermind, it seems like I´m not good in explaining things 🙂

A quick suggestion would be to make a batch file that creates your ${version} directory and then compiles your NSI script to output your EXE into your newly created directory.
So, I have to create a batch file that accepts the version number as a parameter, creates the directory and starts the compile script. The compile script also accepts the version number as a parameter.

Is this what you thought of?

Another option would be to just append your ${version} value to your EXE's filename--that would leave all your builds in 1 directory though.
That´s the way I already have it 🙂
dienjd#
So, I have to create a batch file that accepts the version number as a parameter, creates the directory and starts the compile script. The compile script also accepts the version number as a parameter.

Is this what you thought of?
Exactly. That should work. You can also look into automated building tools that are a little more user-friendly than batch files (e.g., http://finalbuilder.com, http://ant.apache.org/), but that may be overkill if all you want to automate is creating a new directory and having your EXE go there.
dienjd#
Originally posted by kichik
You can create the directory from within the script using:
!system "mkdir ${version}"
Nice, I didn't know about that command. Using it with 'subst' lets you create directories even on unmapped network shares. Very handy.
Guest#
Originally posted by kichik
You can create the directory from within the script using:
!system "mkdir ${version}"
Yeah, great! Exactly what I was looking for.
Thank you very much!


Lars