Fixed output message for CL_WriteConfig_f() to only output when successful.

This commit is contained in:
Knightmare66 2019-04-24 02:53:29 -04:00
parent 5c92e97c2e
commit f9f4527aa4

View file

@ -1741,13 +1741,16 @@ CL_WriteConfiguration
Writes key bindings and archived cvars to config.cfg
===============
*/
void CL_WriteConfiguration (char *cfgName)
qboolean CL_WriteConfiguration (char *cfgName)
{
FILE *f;
char path[MAX_QPATH];
if (!cfgName)
return false;
if (cls.state == ca_uninitialized)
return;
return false;
// Knightmare changed- use separate config for better cohabitation
//Com_sprintf (path, sizeof(path),"%s/config.cfg",FS_Gamedir());
@ -1759,7 +1762,7 @@ void CL_WriteConfiguration (char *cfgName)
//Com_Printf ("Couldn't write config.cfg.\n");
// Com_Printf ("Couldn't write kmq2config.cfg.\n");
Com_Printf ("Couldn't write %s.cfg.\n", cfgName);
return;
return false;
}
fprintf (f, "// This file is generated by KMQuake2, do not modify.\n");
@ -1768,6 +1771,8 @@ void CL_WriteConfiguration (char *cfgName)
fclose (f);
Cvar_WriteVariables (path);
return true;
}
@ -1788,8 +1793,8 @@ void CL_WriteConfig_f (void)
else // if (Cmd_Argc() == 2)
strncpy (cfgName, Cmd_Argv(1), sizeof(cfgName));
CL_WriteConfiguration (cfgName);
Com_Printf ("Wrote config file %s/%s.cfg.\n", FS_Gamedir(), cfgName);
if (CL_WriteConfiguration (cfgName))
Com_Printf ("Wrote config file %s/%s.cfg.\n", FS_Gamedir(), cfgName);
}
else
Com_Printf ("Usage: writeconfig <name>\n");