Author Topic: Working Directory of Post Build Steps  (Read 9078 times)

Offline koonschi

  • Multiple posting newcomer
  • *
  • Posts: 27
    • My personal project
Working Directory of Post Build Steps
« on: May 18, 2013, 10:43:09 am »
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
"As a general rule, the compiler is smarter than you, and working in your best interest. Do not question it." - Terry Mahaffey

#define TRUE FALSE // happy debugging suckers

Offline koonschi

  • Multiple posting newcomer
  • *
  • Posts: 27
    • My personal project
Re: Working Directory of Post Build Steps
« Reply #1 on: May 18, 2013, 10:54:38 am »
Huh, found a solution:

Enchaining multiple commands with & seems to work.

Code: [Select]
cmd /c cd .. &  Server.Test\bin\Debug\ServerTest.exe

previous version
Code: [Select]
cmd /c cd ..
cmd /c Server.Test\bin\Debug\ServerTest.exe

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
"As a general rule, the compiler is smarter than you, and working in your best interest. Do not question it." - Terry Mahaffey

#define TRUE FALSE // happy debugging suckers

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Working Directory of Post Build Steps
« Reply #2 on: May 18, 2013, 03:37:17 pm »
Have you tried inserting the macros '$outputdir' etc... to your post build commands?

Offline koonschi

  • Multiple posting newcomer
  • *
  • Posts: 27
    • My personal project
Re: Working Directory of Post Build Steps
« Reply #3 on: May 19, 2013, 12:00:47 pm »
No, but that could be an approach. Is there a list of all available macros?
"As a general rule, the compiler is smarter than you, and working in your best interest. Do not question it." - Terry Mahaffey

#define TRUE FALSE // happy debugging suckers

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644