Thứ Sáu, 12 tháng 12, 2014

http://stackoverflow.com/questions/22574645/phonegap-android-create-file-if-not-exists-and-write-to-it

var savedFS;

function gotFS(fileSystem) {
    savedFS = fileSystem;
    fileSystem.root.getFile("test.txt", null, gotFileEntry, fail);
}

function gotFS2(fileSystem) {
    alert('trying again');
    fileSystem.root.getFile("test.txt", {create:true}, gotFileEntry, fail);
}

function fail(error) {
    if(error.code == 1) {
        alert('not found');
        gotFS2(savedFS);
    }
    alert(error.code);
}

Không có nhận xét nào:

Đăng nhận xét