I'm trying to write an archiver with streaming write support (a simple format covered by the unpacked template). I implemented an openWrite() function I wanted to test, but PHYSFS_openWrite() never reaches it. It fails in verifyPath() because it uses the directory archiver's stat function, determines it doesn't exist, and returns an error.
It calls DIR_stat() here, and here's an example of my source code:
const char packname[] = "Armor_012_Upper.pack";
int main(int argc, char** argv) {
PHYSFS_init(argv[0]);
PHYSFS_mount(PHYSFS_getBaseDir(), NULL, true);
PHYSFS_setWriteDir(PHYSFS_getBaseDir());
PHYSFS_registerArchiver(&archiver_sarc_default);
printf("Mounting %s...\n\n", packname);
PHYSFS_mount(packname, NULL, true);
PHYSFS_file* test_write = PHYSFS_openWrite("/ActorLink/Armor_012_Upper.bxml");
printf("%p\n", test_write);
}
I'm able to read the file into a buffer with PHYSFS_openRead() and PHYSFS_readBytes() and write it to disk (I omitted the code for this to keep the code snippet short). So the file definitely exists, and the archiver is registered correctly.
TLDR: Writing has very different behaviour from reading which seems to prevent me from even reaching the writing code in my archiver. I could try to re-implement PHYSFS_openWrite() myself, but I would prefer not to if possible.
I'm trying to write an archiver with streaming write support (a simple format covered by the unpacked template). I implemented an
openWrite()function I wanted to test, butPHYSFS_openWrite()never reaches it. It fails inverifyPath()because it uses the directory archiver's stat function, determines it doesn't exist, and returns an error.It calls
DIR_stat()here, and here's an example of my source code:I'm able to read the file into a buffer with
PHYSFS_openRead()andPHYSFS_readBytes()and write it to disk (I omitted the code for this to keep the code snippet short). So the file definitely exists, and the archiver is registered correctly.TLDR: Writing has very different behaviour from reading which seems to prevent me from even reaching the writing code in my archiver. I could try to re-implement
PHYSFS_openWrite()myself, but I would prefer not to if possible.