[physfs] adding archive paths to search paths

Eric Wing ewing2121 at yahoo.com
Fri Nov 29 10:09:27 EST 2002

Thank you for the response. PHYSFS_setSaneConfig
certainly simplified a few things.

I was hoping to use the search path much like the
Unix/DOS PATH environment and set it to multiple
directories at a time which could be embedded in
archives. I am working on a small game which will
allow users to create/add new game objects simply by
placing packages in the game directory. Each package
(game object) contains image files (several hundred),
sound files, runtime scripts, and misc. stuff. I
wanted to allow users to organize the files into
subdirectories since there are so many of files and
avoid the root directory. Also, for development and
testing, it's convenient not to have everything
packaged (maybe only the image files while working on
the scripts). So there may or may not be an actual
physical file structure that mimics the archive

So my plan was to make the "images" subdirectory plus
a "shared_images" part of the path when it was time to
read images, and then change the search path to
"sounds" when it was time to read sounds, etc. I
suppose I could get around this by using strcat on
every file name to prepend the correct subdirectory,
but I was hoping to avoid all the size checks for
string lengths, mallocs, and string copies/concats for
my own convenience.

On a semi-related note, is it possible to access an
archive embedded in another archive? So far I have not
had any success with this.

Finally, I had two questions about writing. First, is
it possible to write a compressed file? I would like
to compress my save game files.

Second, I have a bunch of utilities that rely on
fprintf. Since PhysFS file handles don't seem to be
compatible with standard file handles, is there a good
workaround I can try?

Thank you,

--- "Ryan C. Gordon" <icculus at clutteredmind.org>
> > I have zip-files that contain subdirectories
> inside
> > them. I was wondering how I can add those
> directories
> > to my search path. If I have those directories
> lying
> > around in the real file system, I can add them.
> > However if they only exist in the archives, I
> can't
> > seem to add them.
> Search path entries are meant to be roots of
> directory trees...you can add
> a zipfile as a root of the contained directories.
> That you can add
> subdirectories in the physical filesystem that are
> children of each other
> is a side effect, really.
> Plus, if you were to add separate subdirs from a
> zipfile, the contents
> would all interpolate into one tree anyhow, so you
> might as well create a
> zip that has the structure you want in the first
> place...if you want all
> the files in one view, just put them all in the
> zip's root dir.
> Otherwise, they are accessed as
> "/my/dir/in/the/zip/filename.ext" once
> they are in the search path.
> > Also, I noticed that I have to explicitly add
> > zip-files to my search path before I can see their
> > contents. Is there a more automatic way of making
> them
> > all available automatically?
> Well, we have to know what files to add.  :)  Look
> at
> PHYSFS_setSaneConfig()...if it doesn't fit your
> needs, it will at least
> show you how to do it yourself.

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

More information about the physfs mailing list