[physfs] descent and physfs
Bradley Bell
btb at icculus.org
Tue Mar 18 17:13:49 EST 2003
I just realized, with some slight alteration, this becomes a "caseify" function:
pass it a filename, and it converts it to the actual file as found in the
filesystem...
Quoting Bradley Bell <btb at icculus.org>:
> this is pseudocode!:
> platformExists(char *filename)
> {
> if (stat(filename) != -1)
> return 1;
>
> if (platformIgnoreCase)
> {
> char *d;
> char path[PATH_MAX] = "/";
> LinkedStringList *list, *p;
>
> for (d = firstdirinfilename(filename); d != NULL; d =
> nextdirinfilename(filename))
> {
> if (stat(d) != -1)
> {
> strcat(path, d);
> continue;
> }
> list = enumeratefiles(path);
> p = findinlistinsensitive(list, d);
> if (p)
> {
> strcat(path, p->str);
> strcat(path, "/");
> }
> else
> return 0;
> }
> strcpy(filename, path);
> strcat(filename, "/");
> strcat(filename, basename(filename));
> if (stat(filename) != -1)
> return 1;
> list = enumeratefiles(filename);
> p = findinlistinsensitive(list, d);
> if (p)
> return 1;
> }
> return 0;
> }
More information about the physfs
mailing list