cal at splitreflection.com wrote:
The easiest way to get standard path info on at least some OSs is from env vars. A sampling from my windoze/cygwin system:
APPDATA = 'C:\Documents and Settings\Owner\Application Data’
USERPROFILE = 'C:\Documents and Settings\Owner’
HOMEDRIVE = 'C:'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files’
PROGRAMFILES = 'C:\Program Files’
PWD = '/home/Owner’
HOMEPATH = '\Documents and Settings\Owner’
HOME = '/home/Owner’
TEMP = '/cygdrive/c/DOCUME~1/Owner/LOCALS~1/Temp’
SYSTEMDRIVE = 'C:'
SYSTEMROOT = 'C:\WINDOWS’
WINDIR = ‘C:\WINDOWS’
And the perl script I used to dump vars, as a set doesn’t work quite right here:
#!/usr/bin/perl
printenv
foreach $key (keys %ENV)
{ print “$key = '”, $ENV{$key}, “’\n”;
}
The biggest hastle I see is the relevant vars being different on different OSs.
Beyond the fact that the environment variables are different on each OS,
I don’t believe there is a platform-independent way of accessing these
variables through C/C++ (which seems to be far and away the most common
language used for SDL). The idea of SDL is to abstract all the basic
platform-specific stuff so you don’t have to worry about it. It makes
sense to me that this is the sort of platform-specific thing that SDL
could easily abstract.
What I would suggest is not a whole package, but just a single simple
function, like:
char* SDL_ConfigPath(void);
That will return a string containing the root path into which one should
stick global config files.
For any other file i/o, I would highly suggest a library by the name of
PhysFS. It creates a sort of abstract file system of the same sort as
that used in the Quake engines, which is very useful for any sort of
game development. I’ve been using it for my engine project, and it’s
brilliant. You can find more info on it here: http://icculus.org/physfs/
I think it would be reasonable for SDL to abstract this sort of
functionality, as directory navigation is an important feature required
for many games, and is completely platform dependent. As long as PhysFS
is around to handle it, it’s not a very urgent feature, but it would be
nice.