I've have experienced a problem when switching workspaces where the PROJECT_NAME variable retains the name of the project from the previous workspace.
Steps to reproduce the problem:
Start Code::Blocks with a blank workspace.
Create a new empty project called A.
In Build Options -> Pre/post build steps add the following:
cmd /C echo $(PROJECT_NAME)
Save the workspace as A.workspace.
Repeat the steps above but name the project B and save the workspace as B.workspace.
Exit Code::Blocks
Start Code::Blocks and open A.workspace.
Build the project. The output will be:
-------------- Build: Debug in A (compiler: GNU GCC Compiler)---------------
Linking stage skipped (build target has no object files to link)
Running target post-build steps
cmd /C echo A
A
Click on File->Recent projects and select B.workspace.
(Don't open via File->Open)
Build the project. The output will be:
-------------- Build: Debug in B (compiler: GNU GCC Compiler)---------------
Linking stage skipped (build target has no object files to link)
Running target post-build steps
cmd /C echo A
A
Note that the command line has incorrectly used A for PROJECT_NAME whereas the Build heading correctly shows B.
Code::Blocks 12.11
WinXP
Quote from: empty head on June 28, 2013, 05:57:23 PM
(Don't open via File->Open)
Does it work if you use it?
Quote from: oBFusCATed on June 28, 2013, 06:10:35 PM
Quote from: empty head on June 28, 2013, 05:57:23 PM
(Don't open via File->Open)
Does it work if you use it?
Yes and no. It will sometimes work and other times it won't. I haven't noticed a consistent pattern.
By selecting the workspace via File->Recent projects I get the problem occuring consistently every time.