我在尝试在Phonegap应用程序中创建本地目录时收到了FileError。我正在使用Ripple Emulator进行测试。我已经安装了Cordova File Plugin。
首先,我要求文件系统如下:
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, onFileSystemSuccess, onFileSystemFail);
我的成功处理程序触发:
function onFileSystemSuccess(fileSystem) {
console.log('fileSystem.root: ', fileSystem.root);
var entry = fileSystem.root;
entry.getDirectory("myDirectory", {create: true, exclusive: false}, getDirSuccess, onFileSystemFail);
}
该console.log报告有效的DirectoryEntry对象。但是后来调用了getDirectory错误处理程序:
function onFileSystemFail(evt) {
console.log("onFileSystemFail: ", evt);
}
记录以下内容:
onFileSystemFail:FileError {code:1}
根据the docs,这是一个NOT_FOUND_ERR。但我的理解是,如果无法找到目录,创建标志将会生成目录。
那我为什么会得到这个FileError?
我正在使用: