[英]Where is application-scope location of resources in Eclipse RCP?
I am wrapping some 3rd party application into Eclipse plugin. 我将一些第三方应用程序包装到Eclipse插件中。
This application uses some data files in "current" directory, ie directory where application ran from. 此应用程序使用“当前”目录中的一些数据文件,即运行应用程序的目录。
Initially I put all of theses files at first level in Eclipse plugin project and can access these files via 最初我将所有这些文件放在Eclipse插件项目的第一级,并可以通过访问这些文件
bundle.getEntry("./conf/conf.xml")
unfortunately, this code creates strange URLs like 不幸的是,这段代码创建了奇怪的URL
bundleentry://88.fwk1692538903/./conf/conf.xml
Why is it so? 为什么会这样? Is it possible to put all application-scoped files into some global location and refer it from a plugin?
是否可以将所有应用程序范围的文件放入某个全局位置并从插件中引用它?
Use org.eclipse.core.runtime.FileLocator
to convert the bundleentry
URL to a normal file
URL: 使用
org.eclipse.core.runtime.FileLocator
将bundleentry
URL转换为普通file
URL:
URL bundleURL = bundle.getEntry("...");
URL fileURL = FileLocator.toFileURL(bundleURL);
Note: If the plugin is in a jar rather than expanded during install the URL returned may reference a temporary location in the metadata where the plugin has been expanded. 注意:如果插件位于jar中而不是在安装期间展开,则返回的URL可能会引用插件已扩展的元数据中的临时位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.