Search code examples
file-iogoogle-nativeclient

PepperMount Write operation fails


Am trying to store files in NACL using PepperMount library. But I've some problem in writing files to the persistent storage.

struct stat st;
char data1[1000];
for (int i = 0; i < 1000; i++)
    data1[i] = 'a';

if(0 == ppMount->Creat("ccda.txt", 0, &st)) {
    fprintf(stderr, "File opened");
    ppMount->Ref(st.st_ino);

    ssize_t n = ppMount->Write(st.st_ino, 0, data1, 1000);
    fprintf(stderr, "Wrote %d bytes", n);

    ppMount->Unref(st.st_ino);
} else {
    fprintf(stderr, "File open failed");
}

I tried it in Pepper_20 and Pepper_21, in 20 it failes in open file, and in 21 it fails in write operation. Let me know if this is a known bug or am doing something wrong with my code.


Solution

  • The problem was actually not with the code. Seems like I've to request storage quota from html as well.

    window.webkitStorageInfo.requestQuota(PERSISTENT, 20*1024*1024);