开发者

Convert IFileStore to IPath in Eclipse RCP

Given an IFileSto开发者_运维技巧re and knowledge that it represents a file in the local file system, how can it be converted to the IPath?


I would go with this:

File file = iFileStore().toLocalFile(0, null);
IPath path = Path.fromOSString(file.getCanonicalPath());

The other answer would probably work, but the answer here is likely safer.


Try this:

String path = iFileStore.getParent().getName();
...
IPath iPath = Path.fromPortableString(path);

You probably have to do some string manipulation on the path string where I have the ellipses.

Since you have the test bed, you can more easily determine what code goes in the ellipses. Feel free to update this answer with what you find.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜