我在
中使用make目录IFileStore targetfileParent = targetfileLocation.getParent()。mkdir(EFS.SHALLOW,new SubProgressMonitor(monitor,0));
但我用
测试它if(!targetfileLocation.getParent()。fetchInfo()。exists()){}
它返回true表示找不到由targetfileLocation.getParent()。mkdir创建的父文件夹。然而,我发现在调试过程中成功创建了文件夹。
void processContainer(IContainer container,IProject targetProject,IProgressMonitor monitor) {
try {
IResource[] members = container.members();
for (IResource member : members)
{
if (member instanceof IContainer)
{
processContainer((IContainer)member,targetProject,monitor);
}
else if (member instanceof IFile)
{
IFile memberfile = (IFile)member;
IPath relativefilePath = memberfile.getProjectRelativePath();
String fileName = relativefilePath.toOSString();
if(fileName.endsWith(".java.color")||fileName.endsWith(".color")){
continue;
}
IResource resouce = targetProject.findMember(relativefilePath);
if(resouce==null){
IFile targetfile = targetProject.getFile(relativefilePath);
IFileStore sourcefileLocation = EFS.getLocalFileSystem().getStore(memberfile.getFullPath());
if(memberfile.exists()){
if(!targetfile.exists()){
IFileStore targetfileLocation = EFS.getLocalFileSystem().getStore(workspaceRoot.append(targetProject.getFullPath()).append(relativefilePath));
if(!targetfileLocation.getParent().fetchInfo().exists()){
IFileStore targetfileParent = targetfileLocation.getParent().mkdir(EFS.SHALLOW, new SubProgressMonitor(monitor, 0));
if(!targetfileLocation.getParent().fetchInfo().exists()){
System.out.println("Not exist");
}
}
System.out.println("Copy to distance:"+targetProject.getFullPath().append(relativefilePath).toOSString());
memberfile.copy(targetProject.getFullPath().append(relativefilePath), EFS.SHALLOW, new SubProgressMonitor(monitor, 0));
}
}
}
}
} } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); }
}