我是 Windows Phone 新手(使用 PhoneGap)。当我们使用 PhoneGap 进行文件写入时,创建的文件存储在哪里?我还需要检索手机上的存储路径。
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
navigator.notification.alert("Device Ready");
window.requestFileSystem(LocalFileSystem.APPLICATION, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile("TextFile3.txt", {create: true, exclusive: false}, gotFileEntry, fail);
navigator.notification.alert("gotFS");
}
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
navigator.notification.alert("gotFileEntry");
}
function gotFileWriter(writer) {
navigator.notification.alert("gotFileWriter");
writer.onwriteend = function (evt) {
console.log("contents of file now 'some sample text'");
writer.truncate(11);
writer.onwriteend = function (evt) {
console.log("contents of file now 'some sample'");
writer.seek(4);
writer.write(" different text");
writer.onwriteend = function (evt) {
console.log("contents of file now 'some different text'");
navigator.notification.alert("gotFileWriterEnd");
}
};
};
writer.write("some sample text");
}
function fail(error) {
console.log(error.code);
}