To use: mount a .zip file as usual, open a file as usual, but append '$' plus
the password to the end of the path, like so:
PHYSFS_File *f = PHYSFS_openRead("/path/to/my/file.txt$MyPassword");
Note that this is the "traditional" PKWARE crypto, like you might get from
PkZip 2.04g or Info-ZIP. They have more advanced cryptography in the modern
.zip spec, but that's not implemented here. If you've ever tried to unzip
an archive and were prompted for a password, you probably saw the traditional
crypto at work.
Note that this is NOT a secure thing: if you ship an app that contains a
password, someone with a debugger can retrieve it. Note also that this
password could be available to any code registered as a PHYSFS_Archiver, and
that due to how archives combine into a single file tree, the wrong archiver
can get the password, at a minimum causing it to fail because passwords don't
match.
In short: make sure you know what you're doing before you use this!
We now use a hashtable for lookups of specific paths, and organize the
entries into a directory tree. The end result is fast lookup and fast
enumeration without having to search a sorted array or tapdance with
substrings...which means the rare, mysterious bug where we failed
to find an existing file should be gone now, too.
This lets an application supply its own archivers, where they will work like
any built-in archiver. This allows abstract directory interfaces the same
way that PHYSFS_Io allows stream implementations.
This is a work in progress still. The API is still changing, and will remain
at version 0 until it is finalized (a theoretical future version 1 will be
for when the final public interface changes, not when we evolve the initial
API design).
This would try to build something under the basedir for Windows 95, OS/2, etc,
but those targets are gone now. Modern systems provide this. If a given
system can't in the future, they can pull this code out of revision control
and use it in their implementation of __PHYSFS_platformCalcUserDir().
This change let me remove __PHYSFS_platformGetUserName(), too.
It's only used by archive_dir.c, and it's trivial to make it into
platform-independent code for that one module.
Bonus: less malloc() pressure...now every access to the native filesystem
doesn't require a temporary heap allocation.