*/
qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking)
{
+#ifdef FS_FIX_PATHS
+ char fixedFileName[MAX_QPATH];
+ char *d = fixedFileName;
+ // try to fix common mistakes (\ instead of /)
+ for( ; *filepath ; filepath++, d++ )
+ if( *filepath != '\\' )
+ *d = *filepath;
+ else
+ *d = '/';
+ *d = '\0';
+ filepath = fixedFileName;
+#endif
+
if (FS_CheckNastyPath(filepath, false))
{
Con_Printf("FS_Open(\"%s\", \"%s\", %s): nasty filename rejected\n", filepath, mode, quiet ? "true" : "false");
VM_SAFEPARMCOUNT(1,VM_fgets);
+ // set the return value regardless of any possible errors
+ PRVM_G_INT(OFS_RETURN) = OFS_NULL;
+
filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
if (filenum < 0 || filenum >= PRVM_MAX_OPENFILES)
{
Con_Printf("fgets: %s: %s\n", PRVM_NAME, string);
if (c >= 0 || end)
PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(string);
- else
- PRVM_G_INT(OFS_RETURN) = OFS_NULL;
}
/*