[physfs] windows eccentricities...
Ryan C. Gordon
icculus at clutteredmind.org
Fri May 6 17:50:34 EDT 2005
> okay, so that's pretty much how i was thinking things worked. my
> problem is that i'm working on an app for which i'd like to provide a
> file picker box. i understand the target audience for physFS isn't
> exactly app designers, so maybe it's just not in the cards. but given
> the work that's gone into physFS, it seems like the tools are probably
> 90% there. exposing/adding direct access routines and a sane conversion
> of file-paths would be the final 10%, it seems to me... of course, if i
> was such an expert on such matters, i'd do it myself, so i could be
> speaking out of school here.
Technically, you have everything you need for this, but you have to make
a few assumptions:
1) You need to provide the GUI, either by wiring it up to the OS's file
picker if possible, or making your own dialog. Obviously, UI work is
beyond the scope of physfs itself.
2) If you want a general system-wide dialog, you'd have to add just the
root of the file system to the search path, or use the mount points and
put it in a directory that doesn't overlap with the rest of your search
path (unless you want it to do interpolation, but that's probably not
what what you want).
3) If you're on Windows or OS/2, you'd have to write some native glue
code to enumerate each existing drive letter and use the mount point API
to make sure they don't overlap in the physicsfs file tree. You can
steal this code, if you need it, from platform/win32.c and
platform/os2.c, since we needed this internally to find the CD drives
4) ':' isn't valid in physfs filenames, either, so this would end up
looking like /c/windows/system32 or /nativefiles/cdrive/windows/system32
or whatever...Unix obviously won't have this issue, and techically MacOS
can get around it (either just start at the root of the file tree, or
start in the /Volumes folder if you want the various drives to be the
top of the tree). Cygwin uses /cygdrive/c/windows/system32 for making
Windows drives fit a Unix filesystem schema, and "/" is actually
somewhere in the middle of the tree (C:\cygwin, usually), for comparison.
In terms of file i/o, if the interpolated tree isn't an issue, you'll
have everything you need: file enumeration and isDir, isFile, isSymLink
support. I'd say you'd have to use the mount points API in the
Subversion repository to make this possible in any reasonable way, though.
Whether this makes the effort worth it or not depends on your needs and
your free time. :)
If you take a stab at it, report back on how it goes for you.
More information about the physfs