[physfs] Knowing which archive PhysFS is reading from?

Dennis Schridde devurandom at gmx.net
Sat Feb 7 18:46:41 EST 2009


Am Samstag, 7. Februar 2009 23:43:49 schrieb bugs buggy:
> I can't seem to find a function that will tell you which archice
> physFS is reading from.
>
> Would there be a easy way to detect this?
>
> For example, if we have map1.pak, & map2.pak  (say they are the exact
> same contents) physFS can read everything in both archives, but I
> don't see a way to determine if we are reading from map1.pak, or from
> map2.pak?
> The getRealDir() points to the directory, but I need it to point to
> the file it is reading from in that directory.
>
> Ideas?
If you know where you mounted the directory/archive, you should be able to 
reconstruct the full path. (Maybe there is also a function to give you the 
mountpoint of an archive, I do not know that off hand.)

virtual_filename;
archive_filename = getRealDir(...);
archive_mountpoint = figure_out_mountpoint(archive_filename);
relative_filename = subst(archive_mountpoint, "", virtual_filename);
full_filename = archive_filename + relative_filename;

But generally I assume it is discouraged to care about the real filename, 
since this complicates the whole stuff, also in places where you might not yet 
think about.

--DevU
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://icculus.org/pipermail/physfs/attachments/20090208/45388772/attachment.pgp>


More information about the physfs mailing list