[英]How can I get the absolute path of the preference file for a particular plugin in eclipse plugin development?
I want to read the absolute path of the preference file for a particular plugin which is generally stored at: 我想读取通常存储在以下位置的特定插件的首选项文件的绝对路径:
Platform.getLocation() + "\.metadata\.plugins\org.eclipse.core.runtime\.settings\myPlugin.prefs"
Is there any way to get it directly somehow using eclipse provided Apis instead of hard-coding the 2nd part of the path? 有什么办法可以使用eclipse提供的Apis直接获得它,而不是硬编码路径的第二部分吗?
This should give the correct location: 这应该给出正确的位置:
Bundle rt = Platform.getBundle(IPreferencesConstants.RUNTIME_NAME);
IPath path = Platform.getStateLocation(rt).append(".settings").append("myPlugin").addFileExtension("prefs");
The actual location calculation is in org.eclipse.core.internal.preferences.EclipsePreferences
实际位置计算在
org.eclipse.core.internal.preferences.EclipsePreferences
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.