Does PHYSFS_close really return 0 on error?

David Olsen jolynsbass at gmail.com
Fri Sep 28 19:21:41 EDT 2007


Hi,
I've been using physfs for a project(game) in which I access zip files, and 
because the files inside each zip have the same name, I only use one zip at 
a time in the search path.
This works pretty well, since the game is basically a linear succession from 
one thing to another, and so I use the one zip for a while until they have 
finished that part of game. I then remove that zip from the path, and add 
the next zip, so that when searching for the exact same filenames, it will 
pull them from a different source.
However, I have recently learned that it is not actually working, because 
apparently there are files still open in the .zip. This is according to the 
PHYSFS_error result obtained after calling PHYSFS_removefromsearchpath...

So, I have a function that wraps the open/close functions and keeps a tally 
of succesful opens and closes (according to the return values for those 
functions. 0 = failure for closing a file.) The tally is always equal! For 
each successfully opened file there is one corresponding succesful file 
closing. I have a little thing to output an error message if the return 
value of PHYFS_close(file) is 0, but it *never* shows up! This seems to 
indicate that there should really be no files open inside the .zip, and yet 
the call to remove it from the search path fails because there are.

So, is one of the calls to close the file actually failing, but not saying 
so? Or or there more nefarious forces at work?
Thanks for any help!
-Dave Olsen

p.s. And the solution does not include having my files named differently. 
That's not an option (I'm not the one who named the files, and they must 
remain as they are) 




More information about the physfs mailing list