Implemented FS_SanitizePath. Perhaps expand on this? Not really a clean
way to do it that I can think of, but I can't see the harm in doing this
for all filepaths.
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13117
d7cf8633-e32d-0410-b094-
e92efae38249
return false;
}
+/*
+====================
+FS_SanitizePath
+
+Sanitize path (replace non-portable characters
+with portable ones in-place, etc)
+====================
+*/
+void FS_SanitizePath(char *path)
+{
+ int i, size;
+
+ for(i = 0, size = strlen(path); i < size; i++)
+ {
+ if(path[i] == '\\')
+ path[i] = '/';
+ }
+}
/*
====================
const char *FS_FileWithoutPath (const char *in);
const char *FS_FileExtension (const char *in);
int FS_CheckNastyPath (const char *path, qbool isgamedir);
+void FS_SanitizePath (char *path);
extern const char *const fs_checkgamedir_missing; // "(missing)"
const char *FS_CheckGameDir(const char *gamedir); // returns NULL if nasty, fs_checkgamedir_missing (exact pointer) if missing
for (format = firstformat;format->formatstring;format++)
{
dpsnprintf (name, sizeof(name), format->formatstring, basename);
+
+ FS_SanitizePath(name);
+
if(FS_FileExists(name) && (f = FS_LoadFile(name, tempmempool, true, &filesize)) != NULL)
{
mymiplevel = miplevel ? *miplevel : 0;
for (j = 0; j < Q3MAXTCMODS && layer->tcmods[j].tcmod != Q3TCMOD_NONE; j++)
shaderpass->tcmods[j] = layer->tcmods[j];
for (j = 0; j < layer->numframes; j++)
- {
- for (int i = 0; layer->texturename[j][i]; i++)
- if(layer->texturename[j][i] == '\\')
- layer->texturename[j][i] = '/';
shaderpass->skinframes[j] = R_SkinFrame_LoadExternal(layer->texturename[j], texflags, false, true);
- }
return shaderpass;
}