Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get example how to use writre to a zip archive #67

Open
guielec42 opened this issue Aug 14, 2023 · 3 comments
Open

Get example how to use writre to a zip archive #67

guielec42 opened this issue Aug 14, 2023 · 3 comments

Comments

@guielec42
Copy link

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();
@guielec42 guielec42 changed the title Get example how to use writre to an archive Get example how to use writre to a zip archive Aug 14, 2023
@icculus
Copy link
Owner

icculus commented Aug 14, 2023

You can't write to zip files. It (currently) only allows writing to loose files on the actual filesystem.

@guielec42
Copy link
Author

guielec42 commented Aug 15, 2023 via email

@icculus
Copy link
Owner

icculus commented Aug 15, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants