How do I use environment variables for file paths
I have an environment variable PROJ_A setup on my machine, and the continuous integration machine, however the value of the environment variable is different on both machines. The environment variable is the source folder of my files that will be getting installed.
So if, in command prompt, I run
Code:
echo %PROJ_A%\test.exe
on my machine I'll see
Code:
C:\LocalProjects\ProjA\test.exe
but if I run the same thing on the CI machine, I'll get
Code:
A:\Build\Checkout\ProjA\test.exe
.
I'm wanting to set the source folder of a file being installed, to a path that uses an environment variable. Since this is going to run on a CI server, I won't be able to manually go in and change the compiler variables every time I want to build, so there should be a way to do this.
If there already is a way, I appologize in advance--I'm not seeing it.
Thanks,
Kevin
Re: How do I use environment variables for file paths
Kevin,
You need the value of the environment variable at compile time, right? The only way to handle it is to write a little "helper application" with SetupBuilder to retrieve the value and then push it back to the SetupBuilder compiler. For example, let your helper.exe retrieve the value of the environment variable and write it to an INI file. At compile time (from your script), execute the helper.exe (using #run... with "Wait" enabled) and after it load your compiler variable with the value (#get ini...). If you need help with this, just let me know.
Does this help?
Friedrich
Re: How do I use environment variables for file paths
Perfect explanation, it works, thanks!
Re: How do I use environment variables for file paths
Although it works, I wouldn't be against being able to use environment variables during compile time. :D
Re: How do I use environment variables for file paths
;) Thanks for your suggestion. We'll add a function to support this in the next maintenance build.
Friedrich