0
我在讀取和寫入mozilla xul文件時遇到了問題。 起初,我想簡單地閱讀文件路徑(檢查是否I/O工作) 所以我寫了這個代碼使用mozilla xul讀取和寫入文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="window" title="title">
<script>
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("Desk", ["temp.xml"]);
alert(file.path);
</script>
</window>
它應該顯示警報窗口與路徑temp.xml
(該文件存在於桌面)。但它在Mozilla Firefox中沒有顯示任何內容。 有什麼問題?