【问题标题】:Determine firefox profile being used programatically (macOS)确定以编程方式使用的 Firefox 配置文件 (macOS)
【发布时间】:2019-08-16 14:16:14
【问题描述】:
我将如何以编程方式确定 firefox 在启动时使用的配置文件。我需要能够从我的 OSX 应用程序中执行此操作。我收到一条通知说 Firefox 已打开。如果我知道正在使用的配置文件,我可以确定是否已为该用户配置文件安装了我们的 Firefox 扩展。
我查看了 profile.ini 和 install.ini。但两者都没有让我知道当前正在使用的配置文件。
【问题讨论】:
标签:
firefox
firefox-addon
profile
【解决方案1】:
想到的唯一方法是查看 Firefox 保持打开的文件。从外壳:
pgrep firefox | xargs -I{} lsof -p {} | grep .parentlock | \
awk '{for(i=9;i<=NF;++i)printf $i""FS ; print ""}' # https://stackoverflow.com/questions/1602035/how-to-print-third-column-to-last-column#comment79559682_1602063
但是,如果您安装了一个扩展程序,更可靠的方法可能是让它宣布它安装在哪个配置文件中。