Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: LETARTARE on February 20, 2012, 02:43:08 pm

Title: Variable expansion into script plugin
Post by: LETARTARE on February 20, 2012, 02:43:08 pm
I use 'C::B r7809'
1- I load a workspace named 'Normal' which becomes the current workspace
    'Normal' is displayed in the tab Projects of the Management panel
2 - I load this script in the console to retrieve the name of the workspace
Code
function nameWS() {
/// name  *.workspace
local nameWS = ReplaceMacros(_T("$(WORKSPACE_NAME)") ) + ::DOT_EXT_WORKSPACE;
local filenameWS = ReplaceMacros(_T("$(WORKSPACE_FILENAME)") );
::print(nameWS)
::print(filenameWS)
   }
3- I run the script by typing by hand: : 'nameWS()'
4- I get the following results:
Quote
Normal.workspace
default.workspace
according to http://wiki.codeblocks.org/index.php?title=Variable_expansion#Code::Blocks_workspace (http://wiki.codeblocks.org/index.php?title=Variable_expansion#Code::Blocks_workspace)
I should have:
Quote
Normal.workspace
Normal.workspace
Is this correct or a mistake?
Title: Re: Variable expansion into script plugin
Post by: oBFusCATed on February 20, 2012, 03:02:34 pm
Works correctly here (debugger branch r7780, Cenos 5.6)
Title: Re: Variable expansion into script plugin
Post by: LETARTARE on February 20, 2012, 03:06:08 pm
Thank you very much.
What configuration?
I don't know Cenos.
Title: Re: Variable expansion into script plugin
Post by: oBFusCATed on February 20, 2012, 03:12:54 pm
Centos, sorry for the typo.
Title: Re: Variable expansion into script plugin
Post by: LETARTARE on February 20, 2012, 03:19:28 pm
I like to have the opinion of someone who uses Vista because it is several times that I see any problems using the plugin scripts.

@ oBfuscated
thank you, but I did not know too!
Title: Re: Variable expansion into script plugin
Post by: Jenna on February 20, 2012, 06:16:47 pm
Is the name of the workspace-file really Normal.workspace ?
default.workspace is the default name a workspace is saved as, if you create a workspace, give it a name and say Save workspace, instead of Save workspace as ... .
Title: Re: Variable expansion into script plugin
Post by: LETARTARE on February 20, 2012, 06:23:19 pm
Quote
Is the name of the workspace-file really 'Normal.workspace' ?
yes it is.
I backed up the new workspace 'Normal.workspace' but actually looking in the area of data backup, he had saved 'default.workspace' ??

Title: Re: Variable expansion into script plugin
Post by: MortenMacFly on February 20, 2012, 06:23:23 pm
Is the name of the workspace-file really Normal.workspace ?
Maybe its due to translation...?!
Title: Re: Variable expansion into script plugin
Post by: LETARTARE on February 20, 2012, 06:27:28 pm
No, I tried with 'foo.workspace' I have the result
Quote
foo.workspace
default.workspace

I said that I saved 'save workspace as foo.workspace' and that the modified file in the area data is called 'default.workspace' ???
Title: Re: Variable expansion into script plugin
Post by: Jenna on February 20, 2012, 06:55:51 pm
To be absolutely sure:
You have used "File -> Save workspace as ..." and have saved is as "Normal.workspace", or did you rename the workspace in the project-manager ?

Renaming it there has nothing to do with the physical workspace file written on disk.
This file is always called default.workspace, unless you save the workspace with "File -> Save workspace as ..." .

By the way: it works fine here.
The saving and your script.
Title: Re: Variable expansion into script plugin
Post by: LETARTARE on February 20, 2012, 07:09:32 pm
Thank you for answering me.
1 - I renamed the workspace 'foo.workspace '
2 - I saved the workspace under 'foo.workspace', the file is saved 'foo.workspace', all right
3 - if I try to save again by 'Save workspace'  is saved 'default.workspace'
4 - if I recharge 'C::B', it starts with 'foo.workspace''

The explanation http://wiki.codeblocks.org/index.php?title=Variable_expansion#Code::Blocks_workspace (http://wiki.codeblocks.org/index.php?title=Variable_expansion#Code::Blocks_workspace)
Quote
$(WORKSPACE_FILENAME) : The filename of the current workspace project (.workspace).
seems so wrong

Therefore EVERY TIME I backup 'save as ...' ???