繁体   English   中英

如何在eclipse插件开发中获取特定插件的首选项文件的绝对路径?

[英]How can I get the absolute path of the preference file for a particular plugin in eclipse plugin development?

我想读取通常存储在以下位置的特定插件的首选项文件的绝对路径:

Platform.getLocation() + "\.metadata\.plugins\org.eclipse.core.runtime\.settings\myPlugin.prefs"

有什么办法可以使用eclipse提供的Apis直接获得它,而不是硬编码路径的第二部分吗?

这应该给出正确的位置:

Bundle rt = Platform.getBundle(IPreferencesConstants.RUNTIME_NAME);

IPath path = Platform.getStateLocation(rt).append(".settings").append("myPlugin").addFileExtension("prefs");

实际位置计算在org.eclipse.core.internal.preferences.EclipsePreferences

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM