I'm doing XML according to this answer: http://answers.bitrock.com/questions/63/what-does-the-save-relative-paths-option-mean

I.e. I set the option "Save relative path" but when I save the project I can see that paths are absolute inside XML project file.

I've converted path manually from c:\repo\project\output\program.exe to ./output/program.exe. It works but I still have a problem. if a working directory when I run bulding (either from GUI or console) differs from c:\repo\project, the compiler couldn't convert paths. It adds the path of itself, I mean it convert the path to c:\program file\bitrock installer\bin\output\program.exe.

I.e. it doesn't set work directory to folder where project file is located. However I can live with this because I can run builder from right folder.

The second problem is critical. I wrote:

  <preBuildActionList>

  .....
            <runProgram>
                <program>output\\program2.exe</program>
                <programArguments></programArguments>
            </runProgram>
  ...
  </preBuildActionList>

And it couldn't run the program. The error message is:

Error: Unknown error while running output\program2.exe Error building project

It works if I specify absolute path only. But it won't work for me because we have many configurations where we build install packages. What can I do?

asked 16 Feb '12, 07:31

Alexander's gravatar image

Alexander
16336
accept rate: 0%


I'm not sure I understand the issue. Could you include some snippets including the paths not being relativized?

In addition, you can always using absolute paths but relative to the project directory using the ${build_project_directory}. For example, in the case of the runProgram:

        <runProgram>
            <program>${build_project_directory}/output/program2.exe</program>
            <programArguments></programArguments>
        </runProgram>
link

answered 16 Feb '12, 18:17

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

It works, but it doesn't look like correct solution. I included the example in previous post. Here is another one:

<runProgram>
 <program>${runtime_check}</program>
 <programArguments></programArguments>
</runProgram>

It works because it equals to your example above. ${runtime_check} contains the absolute path to executable (C:\develop\milestone_1.4ng-vs\exe_r\runtimecheck.exe). I set this variable via --setvars

But this one doesn't work even when I run compiler in the same folder as project file (C:\develop\milestone_1.4ng-vs).

<runProgram>
  <program>exe_r/runtimecheck.exe</program>
  <programArguments></programArguments>
</runProgram>

The following sample work too... on my computer. If someone else try to build installation package from different folder, the compilation is failed.

<runProgram>
  <program>C:\\develop\\milestone_1.4ng-vs\\exe_r\\runtimecheck.exe</program>
  <programArguments></programArguments>
</runProgram>
(17 Feb '12, 06:57) Alexander

The answer doesn't fit here, so I'll post it below.

(17 Feb '12, 07:01) Alexander

The <saveRelativePaths> setting does not apply to all the project elements, just to those referring to files considered when packing such as images, or files to bundle within the installer.

In the case of the <runProgram>, if you want to make the call relative to the directory containing the project, the recommend solution would be to use the ${build_project_directory} as I suggest in my previous email. It will work regardless of the location of the project if the relative paths between to tool to call and the project are the same. Could you provide us with more details about why it does not address your issue?

(17 Feb '12, 07:23) juanjo ♦♦

of course, I can use solution you suggested. It works quite well. I just not understand why compiler doesn't run the application by relative path (sample #2). I set working directory correctly. It managed to open files (<readfile>) by relative path but it cannot run the application. I guess it's a bug and you should fix it. I use workaround you have suggested so far. Thanks for your help.

(17 Feb '12, 08:18) Alexander

Could you check the current working directory the builder is using by executing the code below and send us the output?

<prebuildactionlist> <runprogram> <program>cmd</program> <programarguments>/C cd</programarguments> </runprogram> <showinfo> <text>${program_stdout}</text> </showinfo> </prebuildactionlist>

(17 Feb '12, 09:25) juanjo ♦♦

[ 0%] Executing pre build actions [ 0%] Checking output directory [ 0%] Checking if previous build is locked C:\develop\milestone_1.4ng-vs

I've replaced <showinfo> by <consolewrite>

(17 Feb '12, 10:30) Alexander
showing 5 of 6 show all
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×55
×28
×9

Asked: 16 Feb '12, 07:31

Seen: 2,687 times

Last updated: 17 Feb '12, 10:30