Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: LETARTARE on August 14, 2013, 04:41:32 pm

Title: Scripting commands : use 'Project->buildTargets'
Post by: LETARTARE on August 14, 2013, 04:41:32 pm
In the wiki:
http://wiki.codeblocks.org/index.php?title=Scripting_commands#ProjectFile (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.
Title: Re: Scripting commands : use 'Project->buildTargets'
Post by: MortenMacFly on August 16, 2013, 07:28:31 am
Applied in SVN. Thank you! :-)
Title: Re: Scripting commands : use 'Project->buildTargets'
Post by: LETARTARE 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'.