如果Firefox是FirefoxPortable则从addon作用域中检测

问题描述 投票:0回答:1

我正在尝试使我的插件支持便携式Firefox,我可以正常工作,但是我想从同一插件支持便携式和非便携式。我不想为便携式用户单独发布。

因此,我正在尝试从插件中检测运行它的Firefox是否可移植。事实证明,这非常棘手。

这些是其他人们想要帮助的地方:

firefox-addon portable-applications
1个回答
2
投票

我将获得XREExeF路径,向后走一个目录并检查目录AppInfoDefaultData是否存在。

Firefox目录也存在,但对于Aurora和Nightly便携式计算机,其名称可能有所不同。

var exeFile = FileUtils.getFile("XREExeF", []);
var defaultdata = exeFile.parent.parent;
var appinfo = defaultdata.clone();
defaultdata.append("DefaultData");
appinfo.append("AppInfo");

if(defaultdata.exists() && appinfo.exists() && defaultdata.isDirectory && appinfo.isDirectory())
  console.log("This is Portable Firefox");
else
  console.log("This is not Portable Firefox");
© www.soinside.com 2019 - 2024. All rights reserved.