Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT Process Type: ADDFILES(CDT Process Type: ADDFILES)
CDT Process Type: ADDFILES [message #1770452] Fri, 11 August 2017 15:58 Go to next message
Faisal Tariq is currently offline Faisal TariqFriend
Messages: 33
Registered: August 2017
Member
Hello all,



I wish to copy and modify a bunch of files from a directory at C:\my_directory to the Eclipse Workspace. How do I go about doing that with the CDT template.xml? I will make C:\make_directory part of the environment variable.



The process type "AddFiles" shows how it can be done as long as the Source file is in the same directory as the template.xml, as shown by the snippet below, where the file "empty.c" is located in "src", which is in the same folder as template.xml.



<process type="org.eclipse.cdt.core.AddFiles">

<simple name="projectName" value="$(projectName)" />

<complex-array name="files">

<element>

<simple name="source" value="src/empty.c" />

<simple name="target" value="main.c" />

<simple name="replaceable" value="true" />

</element>

</complex-array>

</process>



Thank you.
Re: CDT Process Type: ADDFILES [message #1770547 is a reply to message #1770452] Mon, 14 August 2017 09:14 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 399
Registered: June 2014
Senior Member
Hi Faisal,

The AddFiles runner is here: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFiles.java?id=e8bfecea0bd1de460f3e855c210ecc446e8bb7c9#n75 as you can see from the highlighted line the source argument is passed to TemplateEngineHelper.getTemplateResourceURLRelativeToTemplate to convert it to an absolute path (see http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java?id=e8bfecea0bd1de460f3e855c210ecc446e8bb7c9#n192)

What you need, to collect files from somewhere else, is to write your own process runner. The extension point you want is org.eclipse.cdt.core.templateProcessTypes (https://help.eclipse.org/oxygen/topic/org.eclipse.cdt.doc.isv/reference/extension-points/org_eclipse_cdt_core_templateProcessTypes.html) for example you can see how AddFiles is registered: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/core/org.eclipse.cdt.core/plugin.xml?id=e8bfecea0bd1de460f3e855c210ecc446e8bb7c9#n730

HTH
Jonah
Re: CDT Process Type: ADDFILES [message #1770598 is a reply to message #1770547] Mon, 14 August 2017 19:55 Go to previous message
Faisal Tariq is currently offline Faisal TariqFriend
Messages: 33
Registered: August 2017
Member
Thanks a bunch Jonah. This is much appreciated.
Previous Topic:GCC Cross compiler configuration
Next Topic:Specifying the c++11 standard in Eclipse Luna
Goto Forum:
  


Current Time: Sun Dec 17 11:54:28 GMT 2017

Powered by FUDForum. Page generated in 0.01956 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software