Author Topic: Incorrect PROJECT_NAME on switching workspace  (Read 4529 times)

Offline empty head

  • Single posting newcomer
  • *
  • Posts: 4
Incorrect PROJECT_NAME on switching workspace
« on: June 28, 2013, 05:57:23 pm »
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:

Code
-------------- 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:

Code
-------------- 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Incorrect PROJECT_NAME on switching workspace
« Reply #1 on: June 28, 2013, 06:10:35 pm »
(Don't open via File->Open)
Does it work if you use it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline empty head

  • Single posting newcomer
  • *
  • Posts: 4
Re: Incorrect PROJECT_NAME on switching workspace
« Reply #2 on: June 28, 2013, 06:39:50 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.