开发者

Can you copy resources from an eclipse project to a UNC path programmatically?

I'm trying to co开发者_如何学Gopy resources (IFile) from an eclipse project to another location. The location is a UNC path which I've used before to create IProjects using IProjectDescription. However, when I try to copy the resource using the following code I get a ResourceException:

IResource[] res = project.members();
for (IResource r : res)  {
    if (r instanceof IFile) {
        IFile file = (IFile) r;
        file.copy("\\example.com\User\Folder\sj\", true, null);
    }
}

The exception goes something like this:

org.eclipse.internal.resources.ResourceException: Resource '/corp.dsd' does not exist.

Anyone have any ideas?


Try using the IFileStore API. http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/filesystem/IFileStore.html

You can use getLocation on your IFile and then obtain the filestore for it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜