Author Topic: Variable expansion into script plugin  (Read 5916 times)

Offline LETARTARE

  • Regular
  • ***
  • Posts: 429
  • L'ami de l'homme.The friend of man.
Variable expansion into script plugin
« 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: [Select]
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
I should have:
Quote
Normal.workspace
Normal.workspace
Is this correct or a mistake?
CB-rev12235, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.4, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12898
    • Travis build status
Re: Variable expansion into script plugin
« Reply #1 on: February 20, 2012, 03:02:34 pm »
Works correctly here (debugger branch r7780, Cenos 5.6)
(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 LETARTARE

  • Regular
  • ***
  • Posts: 429
  • L'ami de l'homme.The friend of man.
Re: Variable expansion into script plugin
« Reply #2 on: February 20, 2012, 03:06:08 pm »
Thank you very much.
What configuration?
I don't know Cenos.
CB-rev12235, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.4, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12898
    • Travis build status
Re: Variable expansion into script plugin
« Reply #3 on: February 20, 2012, 03:12:54 pm »
Centos, sorry for the typo.
(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 LETARTARE

  • Regular
  • ***
  • Posts: 429
  • L'ami de l'homme.The friend of man.
Re: Variable expansion into script plugin
« Reply #4 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!
CB-rev12235, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.4, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Online jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Variable expansion into script plugin
« Reply #5 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 ... .

Offline LETARTARE

  • Regular
  • ***
  • Posts: 429
  • L'ami de l'homme.The friend of man.
Re: Variable expansion into script plugin
« Reply #6 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' ??

CB-rev12235, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.4, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Variable expansion into script plugin
« Reply #7 on: February 20, 2012, 06:23:23 pm »
Is the name of the workspace-file really Normal.workspace ?
Maybe its due to translation...?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline LETARTARE

  • Regular
  • ***
  • Posts: 429
  • L'ami de l'homme.The friend of man.
Re: Variable expansion into script plugin
« Reply #8 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' ???
« Last Edit: February 20, 2012, 06:35:31 pm by LETARTARE »
CB-rev12235, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.4, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!

Online jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Variable expansion into script plugin
« Reply #9 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.

Offline LETARTARE

  • Regular
  • ***
  • Posts: 429
  • L'ami de l'homme.The friend of man.
Re: Variable expansion into script plugin
« Reply #10 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
Quote
$(WORKSPACE_FILENAME) : The filename of the current workspace project (.workspace).
seems so wrong

Therefore EVERY TIME I backup 'save as ...' ???
CB-rev12235, plugins : QtPregen-2.7.3-sdk240
1-Win 7 Business Pack 1 64bits :  wx-3.1.4, gcc-8.1.0,
2-Vista Business Pack2 32bits : wx-3.1.4, gcc-8.1.0
3-OpenSuse-15.1-Leap 64bits : wx-3.03, gcc-7.5.
=> !! The messages are translated by Deepl !!