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

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
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
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-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • 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

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
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-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • 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

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
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-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Jenna

  • 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

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
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-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
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-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline Jenna

  • 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

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
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-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl