![](/img/trans.png)
[英]In an Eclipse plugin, how can I make a DirectoryFieldEditor start with a particular path?
[英]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.