簡體   English   中英

如何從我的applet中獲取當前的Firefox配置文件路徑?

[英]How to get the current Firefox profile path from within my applet?

我在我的applet中使用Mozilla的網絡安全服務Java(JSS) ,以便在我的(已簽名)Java Applet和Mozilla Firefox之間進行一些低級別的交互。

我面臨的第一個問題之一是如何找到當前的Firefox配置文件路徑。 我需要它因為我必須調用CryptoManager的initialize(String configDir)方法,所謂的configDir必須是Firefox配置文件的目錄。

如何獲取當前Firefox配置文件的完整路徑? 是否有一個干凈的方式或我必須在{$ APPDATA} / Firefox中閱讀profiles.ini,解析它然后選擇一個隨機的配置文件(希望它只有一個,或者我得到的是正確的)?

提前致謝

在Javascript中,您可以獲取配置文件和可執行文件目錄:

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

var profile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile).path

var CurProcD = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("CurProcD", Components.interfaces.nsIFile).path

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM