[physfs] globbing?

Ryan C. Gordon icculus at clutteredmind.org
Tue Jun 10 22:16:08 EDT 2003

> Has there been any thought on adding a glob type function to physfs?
> AFAICT, this would be pretty easy to do, using fnmatch(3), but that
> doesn't exist on most platforms. I think there is a BSD-licensed
> version out there that could be used, though.

Please update from CVS and look at globbing.h (and the implementation in
globbing.c) in the "extras" directory. It wraps PHYSFS_enumerateFiles()
and does pattern matching by-hand (no external fnmatch() function).

This respects the '*' and '?' wildcards, and has a flag for
case-insensitivity (which only some implementations of fnmatch() have, as
a GNU extension).

Might be neat to do this with a regexp library, but that's academic,

Note that this isn't part of the physfs API, but you can copy the
globbing.c into your project directly, even before the upcoming license
change, since that file is in the public domain.


More information about the physfs mailing list