将我的应用从Android移植到WP8,我在 // myDir / MyFile.html
中使用cordova API编写/阅读这是我的javascript代码:
function writeOnFileSystem() {
window.resolveLocalFileSystemURI(
"/", onSuccess,
onError);
}
function onSuccess(entry) {
entry.getDirectory("myDir", {
create: true,
exclusive: false
}, onGetDirectorySuccess, onGetDirectoryFail);
}
function onError(error) {
console.log("onError ...");
}
function onGetDirectorySuccess(dir) {
dir.getFile("myFile.html", {
create: true,
exclusive: false
}, gotFileEntry, fail);
}
...
function readFile() {
window.resolveLocalFileSystemURL(
"//MyDir/myFile.html", gotFSRead,
onErrorRead);
}