public IVResource createProject(String projectName, String projectToClone, String projectTemplateDirectoryName,
String basePath, boolean initFiles) throws IOException {
if(isProject(projectName)) return getResource(projectName);
IVResource project = createOrionProject(projectName);
IStorage userDir = getUserDirectory();
IStorage projectDir = userDir.newInstance(projectName);
/*
* Load the initial user files extension point and copy the files to the projects root
*/
if(basePath!=null && !basePath.equals("")){
project.create(basePath + "/");
}
if(initFiles){
List<?> extensions = ServerManager.getServerManager().getExtensions(IDavinciServerConstants.EXTENSION_POINT_INITIAL_USER_FILES, IDavinciServerConstants.EP_TAG_INITIAL_USER_FILE);
for (Iterator<?> iterator = extensions.iterator(); iterator.hasNext();) {
IConfigurationElement libraryElement = (IConfigurationElement) iterator.next();
String path = libraryElement.getAttribute(IDavinciServerConstants.EP_ATTR_INITIAL_USER_FILE_PATH);
String name = libraryElement.getDeclaringExtension().getContributor().getName();
Bundle bundle = Activator.getActivator().getOtherBundle(name);
IStorage file =this.getStorage().newInstance(project.getPath());
if(basePath!=null && !basePath.equals(""))
file = file.newInstance(project.getPath()+ "/" + basePath);
VResourceUtils.copyDirectory(file, path, bundle);
}