mount points...

Ryan C. Gordon icculus at clutteredmind.org
Mon Mar 14 02:42:00 EST 2005



...the initial mount points code is in Subversion. It's based on Philip's
patch, but there were about a thousand corner cases I needed to handle, and
some internals had changed dramatically (and, y'know, I can't leave well
enough alone...)

There are some notes:

   PHYSFS_mount("myarc.zip", "/mods/alien_swarm", 1);

...mounts myarc.zip at /mods/alien_swarm. /mods and /alien_swarm don't have to
exist, but they will be treated as real directories as long as myarc.zip is in
the search path. Effectively, PHYSFS_mount is like PHYSFS_addToSearchPath(),
but every file in the archive will have /mods/alien_swarm appended to it.

Conversely, PHYSFS_addToSearchPath("myarc.zip", 1) is like
PHYSFS_mount("myarc.zip", "/", 1).

So if myarc.zip contains "data/aliens.txt", then you could access it with
PHYSFS_openRead("/mods/alien_swarm/data/aliens.txt") ...

There's also PHYSFS_getMountPoint("myarc.zip"), which, in this case, returns
"/mods/alien_swarm".

The immediate use for this is to let you sandbox external content...if you let
people download packages into your game/app, then you can use a mount point to
guarantee it won't conflict with existing packages.

I've only tested it briefly, and I'm sure there will be bugs.

--ryan.






More information about the physfs mailing list