+ Reply to Thread
Results 1 to 5 of 5

Thread: How do I use environment variables for file paths

  1. #1

    Question 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

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default 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

  3. #3

    Default Re: How do I use environment variables for file paths

    Perfect explanation, it works, thanks!

  4. #4

    Default 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.

  5. #5
    Join Date
    Mar 2004
    Posts
    4,307

    Default 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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •