1

With aid of this and this questions I managed to create the most of the desired file structure in a project by copying this from my plugin bundle.

URL templatesURL = Activator.getDefault().getBundle().getEntry(TEMPLATES_PATH);
File templatesFolder = new File(FileLocator.toFileURL(templatesURL).getPath());
copyFiles(templatesFolder, project, monitor);

I have two folders TEMPLATES_PATH + "\test\java" with no files in them. I want these to be created as well, but they don't. Investigations led me to the folder where OSGi extracts the contents of the bundle:

C:\eclipse\configuration\org.eclipse.osgi\<number>\0\.cp

The folders aren't being extracted! I could either create an empty file "test\java\.touch" or create the folders manually with

IFolder testFolder = project.getFolder(new Path("test"));
testFolder.create(true, true monitor);
testFolder.getFolder(new Path("java")).create(true, true monitor);

I can get the desired structure using one of the both ways but I would like to know: is there a way to make FileLocator extract the folders?

Community
  • 1
  • 1
Danny Lo
  • 1,553
  • 4
  • 26
  • 48

1 Answers1

1

Looks like the code that builds the directories is org.eclipse.osgi.storage.bundlefile.ZipBundleFile.

I don't see any way to influence what it does with empty directories.

greg-449
  • 109,219
  • 232
  • 102
  • 145