User forums > General (but related to Code::Blocks)

Working Directory of Post Build Steps

(1/1)

koonschi:
Hi,

I work with the latest nightly and Windows 7.
I wanted to know how to set the working dir for the post build steps of a project. Currently it is always the same directory as the .cbp file. In the properties you can set the execution working dir, but this seems to have no effect on the pre/post-build steps. I need this for automated testing, the tests have data they need to process and will only find it if the executable is called from the correct working dir.

Changing the paths in the software is not an option, as this would imply not only changing the paths in the testing environment (which would not be a big problem) but also in the original code (which would definitely be a problem).

A simple cmd /c cd .. won't do the trick either.

Any help is appreciated.

Thanks,

Koonschi

koonschi:
Huh, found a solution:

Enchaining multiple commands with & seems to work.


--- Code: ---cmd /c cd .. &  Server.Test\bin\Debug\ServerTest.exe

--- End code ---

previous version

--- Code: ---cmd /c cd ..
cmd /c Server.Test\bin\Debug\ServerTest.exe

--- End code ---

didn't work as the console terminated after changing the directory, thus changing nothing.

I'd still be interested if it is possible to change the working directory for the pre/post build steps from codeblocks.

Cheers,

Koonschi

scarphin:
Have you tried inserting the macros '$outputdir' etc... to your post build commands?

koonschi:
No, but that could be an approach. Is there a list of all available macros?

scarphin:
http://wiki.codeblocks.org/index.php?title=Variable_expansion

Navigation

[0] Message Index

Go to full version