Path conversion perhaps?

Ryan C. Gordon icculus at clutteredmind.org
Wed Sep 5 16:19:26 EDT 2001


> ParaGUI  (GUI library for SDL) was just integrated with PhysFS and

Wow...that's cool!

> when updating the Windows build I noticed that the openDirectory
> function doesn't convert the directory to a platform independent
> path. Wouldn't that be a good place to do that, so that you can use
> the same path no matter what the platform is? Or is the application
> expected to convert the path itself before adding it?

No...the path passed into openDirectory needs to be platform-dependent, so
the drivers know how to access the archive specified by this path. The
only "archive" driver that needs to concern itself with converting between
platform-dependent and platform-independent notation is the native
filesystem driver (archivers/dir.c), which does the conversion.

Once an archive driver sucessfully initializes, the path passed into
openDirectory is meaningless to the rest of the library and application.
And, with the exception of dir.c, it's meaningless to the archive drivers,
too, which are now working from a filehandle (or whatnot).

> Just curious if this is a missing feature or intentionally left out
> (this will naturally decide what I do to fix it).

I think it's okay. The trick is to make sure ParaGUI uses the other
abstraction functions (PHYSFS_getUserDir(), PHYSFS_getDirSeparator(), etc)
to make sure it never needs to directly handle a platform-specific path,
even for the PhysicsFS functions that need paths in platform-dependent
notation.

--ryan.






More information about the physfs mailing list