使用jslib的xul单机版
我不知道如何在xul独立应用程序中使用jslib 在chrome.manifest中,我添加了:使用jslib的xul单机版,xul,xulrunner,Xul,Xulrunner,我不知道如何在xul独立应用程序中使用jslib 在chrome.manifest中,我添加了: content jslib jar:chrome/content/jslib.jar!/ 在我的xul文件中,我有: <script type="application/javascript" src="chrome://jslib/io/fileUtils.js" /> 在我的xul文件中,给了我一大堆关于fileUtils.js的警告,但是jslib的typeof仍然没有定义。
content jslib jar:chrome/content/jslib.jar!/
在我的xul文件中,我有:
<script type="application/javascript" src="chrome://jslib/io/fileUtils.js" />
在我的xul文件中,给了我一大堆关于fileUtils.js的警告,但是jslib的
typeof
仍然没有定义。如果我第一次使用firefox--app
运行我的应用程序时,它似乎创建了一个新的配置文件。我通过以下方式获得了此配置文件的位置:
var file = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).
get("ProfD", Components.interfaces.nsIFile);
alert(file.path);
然后我转到我的firefox profile/home/me/.mozilla/firefox/82xw54jj.default/并复制了我的应用程序的profile目录中的extensions目录。现在我可以像这样使用jslib:
Components.utils.import("resource://gre/modules/FileUtils.jsm");
file = new FileUtils.File("/home");
alert(file);
Components.utils.import("resource://gre/modules/FileUtils.jsm");
file = new FileUtils.File("/home");
alert(file);