User forums > Using Code::Blocks

10.05 and Mac OS X 10.6.4 - Program won't run with spaces in path

<< < (3/3)

jthomas:
Also, I like ProfessorO's idea to have the Terminal window emulate the Windows behavior of closing when the program finishes (as soon as the user presses a key). With this behavior added, the command I posted above becomes this:

--- Code: ---osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*/*/*}\\"; clear; \\"${exe% }\\"; echo \'Press any key to continue.\'; read -n 1; exit"' -e 'end tell'
--- End code ---


Yes, it's ugly, but I like that it makes for a fairly consistent experience for students on different platforms. =)


Kudos to ProfessorO for the idea. Make sure you follow his directions on how to set the window's behavior to close on exit:

--- Quote from: ProfessorO on January 29, 2011, 01:48:23 am ---You also have to make sure you go into Terminal / Preferences in the menu, select the Settings icon, Shell tab, and under "When the shell exits:", pick "Close if the shell exited cleanly".
--- End quote ---


If you also want Code::Blocks to be made the active application when your console application exits (normally, Terminal will remain as the active program and you have to manually return to Code::Blocks), you can use this launcher script:

--- Code: ---osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*/*/*}\\"; clear; \\"${exe% }\\"; echo -e \'Press any key to continue...\'; read -n 1; osascript -e \'tell app \\"CodeBlocks\\" to activate\'; exit"' -e 'end tell'
--- End code ---

yunlongzzj:
You are not authorized.
You can login using the 'root' user.

Navigation

[0] Message Index

[*] Previous page

Go to full version