You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
The text was updated successfully, but these errors were encountered:
Update: I fixed this by making the function search the search path for an appropriate handle instead of using the write directory in a fork. I'm still running into a ton of roadblocks trying to get write support working for a simple format, though.
I need to copy files into their own buffers for streaming writes, then rebuild it into an archive when writing is done for it to be even a little bit efficient. I could make it atomic, but I really don't want to rebuild the archive file and write it to disk on every single write. If there's some better way to implement this that doesn't require changing a lot of the PhysicsFS code, that would be great.
Torphedo
changed the title
Unable to call an archiver's openWrite function using PHYSFS_openWrite
Significant complications when writing an archiver with write support
May 19, 2023
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.The text was updated successfully, but these errors were encountered: