Code::Blocks Forums
User forums => Help => Topic started by: Pecan on November 15, 2006, 09:57:58 pm
-
Tools used to substitue $(ACTIVE_EDITOR_FILENAME) in Tools.
I cannot get it to do so since the latest SVN 3222.
Has this been deprecated since %s etc work in abbreviations?
-
Not on purpose. Will look at it tomorrow (actually today).
-
Input:
(http://img247.imageshack.us/img247/5566/aefnyc4.gif)
Output:
-------------- Build: default in activeeditorfilename ---------------
mingw32-g++.exe -Wall -O2 -DD:\Desktop\activeeditorfilename\main.cpp -IC:\MinGW\include -c main.cpp -o obj\main.o
<command line>:1:2: warning: ISO C requires whitespace after the macro name
mingw32-g++.exe -LC:\MinGW\lib -o .\activeeditorfilename.exe obj\main.o -s
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 1 warnings
Don't see anything unusual? Seems to work just fine for me.
EDIT:
Yes, this is the compiler, not tools, I know ;) That's because I never use tools, so I don't even know where to find the menu entry :lol:
But seriously: Compiler, tools, and everything else call the very same function to expand variables, so it either works for all, or it works for none.
-
But... you're right.
I tried tools and configured this:
(http://img293.imageshack.us/img293/213/0001vz8.png)
... and got:
$(ACTIVE_EDITOR_NAME) 15728 2006-11-16 D:\wxWidgets-2.6.3
Process returned 0 (0x0) execution time : 0.031 s
Press any key to continue.
Everything is expanded correctly, except $(ACTIVE_EDITOR_NAME).
-
I've implemented a partial fix so far. Partial as in "fixes the problem you observed", but it still doesn't work.
The problem that you observed is peculiar insofar as $(ACTIVE_EDITOR_NAME) is not recognised as variable at all. And more, this is true for any other variable being at the beginning of a string, too. That's because the regex matching the variables was too simple (worked fine for the compiler, which I tested with). This is fixed now.
However, now I see another issue. $(ACTIVE_EDITOR_NAME) is recognised as variable, but it seems to be empty.
-
Hmm... are you sure this ever worked? :shock:
ToolsManager::Execute() contains the lines:
// hack to force-update macros
Manager::Get()->GetMacrosManager()->RecalcVars(0, 0, 0);
... but RecalcVars(0, 0, 0) really runs:
if(!editor)
{
m_ActiveEditorFilename = wxEmptyString;
m_lastEditor = NULL;
}
RecalcVars(0, 0, 0) does not reload anything. It's been like that for ages (revision 1497, December 2005), so I could not imagine that $(ACTIVE_EDITOR_NAME) ever worked correctly in tools, under that premise...
I'll try what happens if the behaviour of RecalcVars(0, 0, 0) is changed to reload the current editor/project name (if any). Should not do any harm (hopefully).
-
Right... it does work. Now I remember, it's that terribly complicated thing with setting everything to zero, so it updates on the next call to ReplaceMacros()... all is fine. No changes necessary.
The reason why it still did not work was because I was using $(ACTIVE_EDITOR_NAME), not $(ACTIVE_EDITOR_FILENAME) to test... of course that one will always be empty. Stupid me :)
So I guess one can consider the issue resolved.
-
Again, thank you thomas.
Works fine.