我正在尝试(非常简单)使用 webworks 获取相机目录的文件列表。我正在尝试的代码如下:
function displayPhotos(id) {
try {
var Dir, path, items;
if ((window.blackberry === undefined) || (blackberry.io === undefined) || (blackberry.io.file === undefined)) {
appendContent("photoDetails", "<p><i><b>blackberry.io.file</b> object not found (likely cause is WebWorks APIs are not supported by this user agent).</i></p>");
debug.log("displayPhotos", "blackberry.io.file object is undefined.", debug.error);
return false;
}
Dir = blackberry.io.dir;
path = "";
path = "file:///Device/home/user/camera"";
items = Dir.listFiles(path);
console.log(items);
//setContent(id, formatAsHTML(path, items));
}
catch(e) {
console.log("displayPhotos", e, debug.exception);
}
}
我得到的只是错误1004-我认为这是基于权限的,但我不相信我无法在相机上读取失败-有人知道吗?
干杯!