Get example how to use writre to a zip archive
Hello,
I'm trying PhyFS, seams really intresting but there is no example how to use write. Result is a corrupted zip file It would be great if I can get some help to understand what is wrong. I'm using 3.3 release. here is my simple code: PHYSFS_init("d:\"); PHYSFS_setWriteDir("d:\");
PHYSFS_mount("d:\\testw.zip", "/" , true);
const char* writedir = PHYSFS_getWriteDir();
std::cout << writedir << std::endl; // for testing
PHYSFS_File* txtwtest = PHYSFS_openWrite("/txt2.txt");
int test = PHYSFS_writeBytes(txtwtest, "testwr", 5); // return 5 so it did write somewhere
PHYSFS_close(txtwtest);
PHYSFS_unmount("d:\\test.zip");
PHYSFS_deinit();
You can't write to zip files. It (currently) only allows writing to loose files on the actual filesystem.
I confirm, I can write to the local filesystem. Is it a limitation due to zip archive or more global ?
On Mon, Aug 14, 2023 at 5:41 PM Ryan C. Gordon @.***> wrote:
You can't write to zip files. It (currently) only allows writing to loose files on the actual filesystem.
— Reply to this email directly, view it on GitHub https://github.com/icculus/physfs/issues/67#issuecomment-1677578901, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWTBT3ZPS4Q3JADNYHPVDTXVJBK3ANCNFSM6AAAAAA3PIXK5I . You are receiving this because you authored the thread.Message ID: @.***>
The API allows it, but it's not implemented for anything but the native filesystem. There are questions about how to rewrite a .zip file to make this work cleanly, since you'd have to deal with the existing data, etc.