Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

How to get Workspace Path #773

chetangeo ·
Hi
I am using QB 2.0.2 i want to get path of working directory in Environment Variable but i am not able to get it.
I am using WORKDIR=${node.getWorkspaceDir()} but it is giving error.
  • replies 9
  • views 4382
  • stars 0
roger ·
This is what I use:

WORKDIR=${configuration.getWorkspaceDir()}
robinshen ADMIN ·
Roger is right on this. The "getWorkspaceDir()" method of configuration object returns workspace directory on current node.
chetangeo ·
Thanks it is working.
ringn ·
I think I'm trying to do something similar.

I'm using SVN and want to define an environment variable for a specific build step to be the current workspace. To do this I have the following in my Environment Variables section:

WORKDIR=${configuration.getWorkspaceDir()}

Then in my build command I'm running the command:

make -f $WORKDIR/build_script/Makefile

The build is failing because the WORKDIR variable is not being resolved. What am I missing?

Thanks much ...

Nolan
robinshen ADMIN ·
I guess the command "make -f $WORKDIR/build_script/Makefile" is defined as the command property of a command build step. In this case, you will not need to use environment variables. Just define the command as below will work:
make -f ${configuration.workspaceDir.absolutePath}/build_script/Makefile
ringn ·
Thanks much and, in fact, you're correct, the command:

make -f ${configuration.workspaceDir.absolutePath}/build_script/Makefile

resolves the path to the workspace correctly.

However, the Makefile itself in this example references $WORKDIR ... what I was hoping to do was define WORKDIR as an environment variable that would be resolved when $WORKDIR was encountered in the Makefile.

For example, the Makefile contains a target with the the following contents:

rpm:
(rm -rf $(WORKDIR)/results) || echo "no old rpms"
mkdir $(WORKDIR)/results

When $(WORKDIR) isn't defined I get errors that /results can't be created ...

Hopefully this more clearly defines what I'm trying to do...

Thanks for your quick response.

Nolan
robinshen ADMIN ·
Then you will need to define the environment variable as you've already done, but for the command defined in the command build step, still use the syntax I suggested, since environment variable only takes effect in the forked command process.
ringn ·
Woohoo!!!!! Thank you thank you thank you ... that did it!!! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
robinshen ADMIN ·
Glad to be helpful, <!-- s8) --><img src="{SMILIES_PATH}/icon_cool.gif" alt="8)" title="Cool" /><!-- s8) -->