[
https://issues.apache.org/jira/browse/CB-6629?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ian Clelland updated CB-6629:
-----------------------------
Description:
When i try to use this code :
{code}
window.requestFileSystem = window.requestFileSystem ||
window.webkitRequestFileSystem;
window.LocalFileSystem = window.LocalFileSystem || {PERSISTENT:
window.PERSISTENT};
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
function gotFS(fileSystem) {
fileSystem.root.getDirectory("DO_NOT_DELETE",
{create: true, exclusive: false},
gotDirEntry,
fail);
}
function gotDirEntry(dirEntry) {
dir = dirEntry;
dirEntry.getFile("sample.json",
{create: false, exclusive: false},
readSuccess,
fileDonotexist);
}
function fileDonotexist(dirEntry) {
dir.getFile("sample.json",
{create: true, exclusive: false},
gotFileEntry,
fail);
}
function gotFileEntry(fileEntryWrite) {
fileEntryWrite.createWriter(gotFileWriter, fail);
}
function gotFileWriter(writer) {
writer.onerror = function(evt) {
};
writer.write(localData);
writer.onwriteend = function(evt) {
dir.getFile("sample.json",
{create: false, exclusive: false},
readSuccess,
fail);
};
}
function readSuccess(fileE) {
fileE.file(readAsText, fail);
}
function fail(error) {
alert("fail");
}
function readAsText(readerDummy) {
var reader = new FileReader();
reader.onloadstart = function(evt) {};
reader.onprogress = function(evt) {};
reader.onerror = function(evt) {};
reader.onloadend = function(evt) {
console.log("read success");
};
reader.readAsText(readerDummy);
}
{code}
my app crashed and she is turning off. what's wrong ?
was:
When i try to use this code :
window.requestFileSystem = window.requestFileSystem ||
window.webkitRequestFileSystem;
window.LocalFileSystem = window.LocalFileSystem || {PERSISTENT:
window.PERSISTENT};
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
function gotFS(fileSystem) {
fileSystem.root.getDirectory("DO_NOT_DELETE",
{create: true, exclusive: false},
gotDirEntry,
fail);
}
function gotDirEntry(dirEntry) {
dir = dirEntry;
dirEntry.getFile("sample.json",
{create: false, exclusive: false},
readSuccess,
fileDonotexist);
}
function fileDonotexist(dirEntry) {
dir.getFile("sample.json",
{create: true, exclusive: false},
gotFileEntry,
fail);
}
function gotFileEntry(fileEntryWrite) {
fileEntryWrite.createWriter(gotFileWriter, fail);
}
function gotFileWriter(writer) {
writer.onerror = function(evt) {
};
writer.write(localData);
writer.onwriteend = function(evt) {
dir.getFile("sample.json",
{create: false, exclusive: false},
readSuccess,
fail);
};
}
function readSuccess(fileE) {
fileE.file(readAsText, fail);
}
function fail(error) {
alert("fail");
}
function readAsText(readerDummy) {
var reader = new FileReader();
reader.onloadstart = function(evt) {};
reader.onprogress = function(evt) {};
reader.onerror = function(evt) {};
reader.onloadend = function(evt) {
console.log("read success");
};
reader.readAsText(readerDummy);
}
my app crashed and she is turning off. what's wrong ?
> App crashed with file function
> ------------------------------
>
> Key: CB-6629
> URL: https://issues.apache.org/jira/browse/CB-6629
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File
> Affects Versions: 3.4.0
> Environment: Android
> Reporter: alpg 78
> Priority: Blocker
>
> When i try to use this code :
> {code}
> window.requestFileSystem = window.requestFileSystem ||
> window.webkitRequestFileSystem;
> window.LocalFileSystem = window.LocalFileSystem || {PERSISTENT:
> window.PERSISTENT};
> window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
> function gotFS(fileSystem) {
> fileSystem.root.getDirectory("DO_NOT_DELETE",
> {create: true, exclusive: false},
> gotDirEntry,
> fail);
> }
> function gotDirEntry(dirEntry) {
> dir = dirEntry;
> dirEntry.getFile("sample.json",
> {create: false, exclusive: false},
> readSuccess,
> fileDonotexist);
> }
> function fileDonotexist(dirEntry) {
> dir.getFile("sample.json",
> {create: true, exclusive: false},
> gotFileEntry,
> fail);
> }
> function gotFileEntry(fileEntryWrite) {
> fileEntryWrite.createWriter(gotFileWriter, fail);
> }
> function gotFileWriter(writer) {
> writer.onerror = function(evt) {
> };
> writer.write(localData);
> writer.onwriteend = function(evt) {
> dir.getFile("sample.json",
> {create: false, exclusive: false},
> readSuccess,
> fail);
> };
> }
> function readSuccess(fileE) {
> fileE.file(readAsText, fail);
> }
> function fail(error) {
> alert("fail");
> }
> function readAsText(readerDummy) {
> var reader = new FileReader();
> reader.onloadstart = function(evt) {};
> reader.onprogress = function(evt) {};
> reader.onerror = function(evt) {};
> reader.onloadend = function(evt) {
> console.log("read success");
> };
> reader.readAsText(readerDummy);
> }
> {code}
> my app crashed and she is turning off. what's wrong ?
--
This message was sent by Atlassian JIRA
(v6.2#6252)