很久很久以前

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  34 随笔 :: 4 文章 :: 17 评论 :: 0 Trackbacks
获得插件的绝对路径:
    /**
     * 得到插件的绝对路径
     * 
     * 
@return 路径
     
*/

    
public static String getPath() {
        String path;
        
try {
            path 
= FileLocator.toFileURL(
                    Platform.getBundle(pluginId).getEntry(
"")).getPath();
            path 
= path.substring(path.indexOf("/"+ 1, path.length());
        }
 catch (IOException e) {
            path 
= "";
            e.printStackTrace();
        }

        
return path;
    }
其中FileLocator#toFileURL是在3.2中添加的,代替了原来的Platform#asLocalURL,并且对于FileLocator#toFileURL,if the plugin was a jar, it will extract the file into a temporary location
posted on 2006-05-01 22:45 Long Long Ago 阅读(747) 评论(0)  编辑  收藏 所属分类: Eclipse

只有注册用户登录后才能发表评论。


网站导航: