Create a IFolder on a project with an extra level [message #1733316] |
Thu, 26 May 2016 09:03  |
Eclipse User |
|
|
|
hi,
I want to create a project with a folder containing another folder.
I tried this :
IFolder ifolder = project.getFolder("src" + File.separatorChar + "extraDir");
ifolder.create(true, true, monitor);
ICSourceEntry newEntry = new CSourceEntry(ifolder , null, 0);
ICProjectDescription description = CCorePlugin.getDefault().getProjectDescription(project);
ICConfigurationDescription configs[] = description.getConfigurations();
for(int i=0; i < configs.length; i++){
ICConfigurationDescription config = configs[i];
ICSourceEntry[] entries = config.getSourceEntries();
Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
for (int j=0; j < entries.length; j++) {
if(new Path(entries[j].getValue()).segmentCount() == 1)
continue;
set.add(entries[j]);
}
set.add(newEntry);
config.setSourceEntries(set.toArray(new ICSourceEntry[set.size()]));
}
CCorePlugin.getDefault().setProjectDescription(project, description, false, monitor);
But, I have :
project
|
---- src/extraDir
I want :
project
|
---- src
|
--------- extraDir
An idea ?
thank you
chris
|
|
|
Re: Create a IFolder on a project with an extra level [message #1733318 is a reply to message #1733316] |
Thu, 26 May 2016 09:01   |
Eclipse User |
|
|
|
If you're using the APIs of the CDT project, you're probably best to as
on the CDT forum.
On 26.05.2016 15:03, kkt8 Mising name wrote:
> hi,
>
> I want to create a project with a folder containing another folder.
> I tried this :
>
> IFolder ifolder = project.getFolder("src" + File.separatorChar +
> "extraDir");
You should be using
org.eclipse.core.resources.IContainer.getFolder(IPath) because the above
method should take the name of a file and that should just be a single
segment of a path name. So I don't think this makes sense.
> ifolder.create(true, true, monitor);
Is this throwing an exception?
> ICSourceEntry newEntry = new CSourceEntry(ifolder , null, 0);
> ICProjectDescription description =
> CCorePlugin.getDefault().getProjectDescription(project);
> ICConfigurationDescription configs[] = description.getConfigurations();
> for(int i=0; i < configs.length; i++){
> ICConfigurationDescription config = configs[i];
> ICSourceEntry[] entries = config.getSourceEntries();
> Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
> for (int j=0; j < entries.length; j++) {
> if(new Path(entries[j].getValue()).segmentCount() == 1)
> continue;
> set.add(entries[j]);
> }
> set.add(newEntry);
> config.setSourceEntries(set.toArray(new
> ICSourceEntry[set.size()]));
> }
> CCorePlugin.getDefault().setProjectDescription(project, description,
> false, monitor);
>
>
> But, I have :
> project
> |
> ---- src/extraDir
>
> I want :
> project
> |
> ---- src
> |
> --------- extraDir
>
> An idea ?
> thank you
>
> chris
|
|
|
|
Powered by
FUDForum. Page generated in 0.03746 seconds