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

Offline LETARTARE

  • Regular
  • ***
  • Posts: 390
  • L'ami de l'homme.The friend of man.
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: [Select]
Hello1.zipI suggest a fix for r9251
Code: [Select]
implement_GetbuildTargets_r9251.patch
Thank you for your answers.
« Last Edit: August 14, 2013, 04:44:37 pm by LETARTARE »
C::B  : svn11831, wx2.8, 3.1.1, plugins : QtPregen-2.6.2-sdk143
1-Vista Business Pack 2 32bits : gcc-8.1.0,
2-OpenSuse-15.1-Leap 64bits :  gcc-7.4.1,
=> !! The messages are translated by Deepl !!

Offline MortenMacFly

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

Offline LETARTARE

  • Regular
  • ***
  • Posts: 390
  • L'ami de l'homme.The friend of man.
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 »
C::B  : svn11831, wx2.8, 3.1.1, plugins : QtPregen-2.6.2-sdk143
1-Vista Business Pack 2 32bits : gcc-8.1.0,
2-OpenSuse-15.1-Leap 64bits :  gcc-7.4.1,
=> !! The messages are translated by Deepl !!