[physfs] PHYSFS_mount a directory of an archive?
Ryan C. Gordon
icculus at icculus.org
Sat Apr 12 18:44:23 EDT 2014
On 04/11/2014 05:28 AM, Martin Felis wrote:
> In the Android port of the LÖVE engine I am using SDL2 and the
> development branch of PhysFS successfully to do what you want.
>
> I first read the file using SDL_RWops from the assets directory into
> memory and then use PHYSFS_mountMemory to load the file.
I think he's asking if you can mount an arbitrary subdirectory in an
archive, so instead of mounting "x.zip" and opening "/y/z.txt" inside of
there, he wants to mount "x.zip/y" and read "/z.txt".
It makes sense to be able to do that; after all, we don't require you to
mount "/" and then read "/home/icculus/z.txt" for the native filesystem
archiver...you'd just mount "/home/icculus", of course.
I first misread the original question as asking for archive-in-archive,
which might be what you did, too. If that's the case, I'd recommend you
try PHYSFS_mountHandle() instead of PHYSFS_mountMemory(), so you don't
have to have the whole archive in RAM at all times, if it can be
reasonably backed by disk/flash memory/whatever. This is probably more
important on something memory-constrained like the usual Android
devices. The downside of this is that archives inside compressed
archives become extremely CPU-hungry (since seeking around means we have
to rewind the compressed outer file and uncompress back to the right
point)...but a compressed .zip file residing uncompressed inside another
.zip file is very fast.
(Maybe I misread your reply, too, though, and I should instead solve
this problem by getting native .apk archive support into PhysicsFS instead.)
--ryan.
More information about the physfs
mailing list