Try the following launcher script (Settings menu -> Environment, and replace the bottom text box labeled "Terminal to launch console programs" with the command below):
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*/*/*}\\"; clear; \\"${exe% }\\""' -e 'end tell'
My students have reported success using it so far, so give it a try if you're having difficulty. It also allows you to have spaces in the name of your project and parent directories and clears the Terminal screen so that the only thing displayed is the output of the program. =)
Try the following launcher script (Settings menu -> Environment, and replace the bottom text box labeled "Terminal to launch console programs" with the command below):
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*/*/*}\\"; clear; \\"${exe% }\\""' -e 'end tell'
My students have reported success using it so far, so give it a try if you're having difficulty. It also allows you to have spaces in the name of your project and parent directories and clears the Terminal screen so that the only thing displayed is the output of the program. =)
I'm using CodeBlocks on OSX 10.8.5; C::B Build Dec 27, 2012 wx2.8.12.
I've been experiencing the same problem as the OP. Terminal has been launching in my home directory instead of the directory containing the compiled executable.
I just tried jthomas' solution but it was not quite working as written. I had to modify the 'cd \\"${exe%/*/*/*}\\";' portion.
There were too many /* in his cd command.
Here is a the same command with my modifications. It's working in the current build.
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*}\\"; clear; \\"${exe% }\\""' -e 'end tell'