emcc untitled.cpp -o filetest.html -lidbfs.js -s FETCH=1 -s FORCE_FILESYSTEM=1 -s NO_EXIT_RUNTIME=1
Let me just brief you about the code :
1) I have mounted following directory in IDBFS : "working1"
EM_ASM(
FS.mkdir('/working1');
FS.mount(IDBFS, {}, '/working1');
FS.syncfs(true, function (err) {
assert(!err);
});
);
2) call util_create func which in turn call test func. In test func I am creating new file "/working1/twrite.txt" "/working1/working2/twrite1.txt" and "/working1/twrite2.txt"
3) call sync_idbfs() which is used to persists changes in indexed db i.e. working1
Error : when call read_fs(func used for reading file) on file :"/working1/working2/twrite1.txt" -> I am getting following error : stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.
please note that in all my printf statement I have got \n and also the flag is passed while compiling.
And also, I am not able to see following file "/working1/working2/twrite1.txt" in indexed db of browser but I am able to see following file twrite.txt and twrite2.txt.
So my question is that , has anyone created a sub directory using IDBFS file system. And pointer on the same i.e what all thing I can try.
Please note that I have unsuccessfully tried following thing :
1) before mounting creating sub directory as well i.e. FS.mkdir('/working1'); and FS.mkdir('/working1/working2');
2) before creating new file in sub directory i,e FS.mkdir('/working1/working2'); and creating new file in sub dir.
Regards,
Anshul