Author Topic: Scripting commands : use 'Project->buildTargets'  (Read 6899 times)

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Scripting commands : use 'Project->buildTargets'
« on: August 14, 2013, 04:41:32 pm »
In the wiki:
http://wiki.codeblocks.org/index.php?title=Scripting_commands#ProjectFile
Quote
buildTargets
is a PUBLIC class variable to retrieve the targets file.

If we write ('prjfile' is a ProjectFile) :
Quote
local Targetsfile = prjfile.buildTargets
and after finishing with the local variable :
Quote
Targetsfile.Clear()
it may happen that the files are REMOVED from the project !

The use of a PUBLIC class variable, in that event, causes side effects.

I enclose a 'Hello.cbp' with a test script that demonstrates this problem.
Code
Hello1.zip
I suggest a fix for r9251
Code
implement_GetbuildTargets_r9251.patch 

Thank you for your answers.
« Last Edit: August 14, 2013, 04:44:37 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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Scripting commands : use 'Project->buildTargets'
« Reply #1 on: August 16, 2013, 07:28:31 am »
Applied in SVN. Thank you! :-)
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: Scripting commands : use 'Project->buildTargets'
« Reply #2 on: August 16, 2013, 11:54:59 am »
thank you. Still effective !

But should we keep "wxArrayString buildTargets" user accessible ?
I think that this variable must be 'private' or 'protected'.
« Last Edit: August 16, 2013, 03:08:00 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