簡體   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